|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Access 2000
Hi,
Can anyone help me make sense of SQL strings. I have an ADO connection to a database and am attempting to insert data into a table. I have the insert.... & "Values ('" & olptbl & "'," & 1 & ", " & 0 & ", " & olpdate & ", " & mydate _ & ", " & mytime & ", " & uid & ", " & "'CARD'" & ", " & olid & ", " & olcrdtype _ & ", '" & olcardno & "', '" & olexp & "', '" & "" & olpaid _ & ", " & 0 & ", " & 0 & ", " & tnum & ", " & -1 & ", " & -1 & "," & mitem _ & ", " & 0 & ", " & -1 & ", " & 0 & ", " & N & ", " & 0 & ", " & olpaid _ & ", " & 0 & " ," & -1 & ", " & 0 & ")" How do I know when I need double quotes verses single quote? I'm getting a syntax error and am not sure what I am looking at. Appreciate any help. |
|
#2
|
|||
|
|||
|
Re: Access 2000
String, text values need to be in single quotes, numeric values do not. For SQL, dates are generally delimited by single quotes. Traditionally Acess has used # to delimit date values. Unfortunately I've never used ADO against an Acess2000 mdb, so I can't say for sure which will work. I'd guess the # would still be the preferred, unless Access has migrated to a standard SQL syntax for compatability with SQL Server.
...joe Quote:
|
|
#3
|
|||
|
|||
|
Yes, # will work fine for date fields.
|
|
#4
|
|||
|
|||
|
you can post strings with single quotes around them at all times, access is happy.
if you want null, then obviously you need to get shot of them. e.g. "insert into blah values(blah, blah, blah) ('" & strBlah & "'.'" & strBleh & "', '" & strBleach & "')" if you need a null, test the variables with an if statement and remove the ' ' from the insert. then if it is null, post null and if its got something in it, post "'" & strBleh & "'" |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Access 2000 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|