|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
date problem
hi all...
here is my code Set con = server.creteobject ("ADODB.Connection") con.Open "mydb" resultupdate = "INSERT INTO db (date) VALUES (#"&now()&"#)" con.Execute resultupdate But it give error -- Syntax error in INSERT INTO statement. any idea?? thx |
|
#2
|
|||
|
|||
|
hi ieie,
I have several ideas about possible problems.... 1, you misspelled crea teobject, i assume it was a misstyping here or something since you said you can connect 2, you don't specify a name/password in your code, generally annonymous browsing is disabled but if you've enabled it, have you enabled insert commands for that user? and if so, i'd recommend changing it and not doing it that way.... 3, this looks like an access query, are you using msSQL server or access? |
|
#3
|
|||
|
|||
|
Use spaces to make your code readable. Will help you, as well.
INSERT INTO db (date) VALUES ('" & now() & "')" Notice the single quotes Access uses the # to indicate datetime values. I prefer passing a string. That works also for SQL Server and others |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > date problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|