|
-
May 4th, 2000, 01:43 AM
#1
Thread Starter
New Member
(Thanks for people who replied to my last query about .dbf to .mdb, it was a lot of help, however....)
I am constructing an SQL string which INSERTS data into an mdb database. I build the string by placing the variable for each field (i.e. '" & varname & "' ), but one of the variables has a double quotation mark in the string (e.g. tyre 19.5").
So, the SQL string errors because the resulting string shows 'tyre 19.5"'. Is there any way of getting around the problem of strings containing double (and single) quotation marks, so that the resulting SQL statement does not error?
this is the code:
strSend = "INSERT INTO flat "
strSend = strSend & "("
strSend = strSend & Flat01 & ", " & Flat02 & ", " & Flat03 & ", " & Flat04 & ", " & Flat05 & ", " & Flat06 & ", " & Flat07 & ", " & Flat08 & ", " & _
Flat09 & ", " & Flat10 & ", " & Flat11 & ", " & Flat12 & ", " & Flat13 & ", " & Flat14 & ", " & Flat15 & ", " & Flat16 & ", " & Flat17 & ", " & Flat18 & ", " & _
Flat19 & ", " & Flat20 & ", " & Flat21 & ", " & Flat22 & ", " & Flat23 & ", " & Flat24 & ", " & Flat25 & ", " & Flat26 & ", " & Flat27 & ", " & Flat28 & ", " & _
Flat29 & ", " & Flat30 & ", " & Flat31 & ", " & Flat32 & ", " & Flat33 & ", " & Flat34 & ", " & Flat35 & ", " & Flat36 & ", " & Flat37 & ", " & Flat38 & ", " & _
Flat39 & ", " & Flat40 & ", " & Flat41 & ", " & Flat42 & ", " & Flat43 & ", " & Flat44 & ", " & Flat45 & ", " & Flat46 & ", " & Flat47 & ", " & Flat48 & ", " & Flat49 & ")"
strSend = strSend & " VALUES ("
For x = 0 To 47
strSend = strSend & "'" & rsDBF.Fields(x) & "', "
Next x
strSend = strSend & ")"
retval = cnMDB.Execute(strSend)
(It's one of the rsdbf.Fields(x) strings that contains a ".
Thanks if anyone can help me, I'm on a really tight deadline........
Phil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|