|
-
Apr 6th, 2002, 12:34 AM
#1
Thread Starter
Fanatic Member
Using strings in SQL statement.....
Hey, I resolved my adding records problem, but I need to fix this last error. Rikk gave me a tip on how to do this, but I keep getting the error. It has to do with the strings containing the '.
I changed the SQL to REPLACE the ' with ''. Here's what I've got:
VB Code:
SQL = "INSERT into " & table & " VALUES ('" & Replace(strFilepath, "'", "''") & "','" & Replace(strFileName, "'", "''") & "','" & Replace(strFileSize, "'", "''") & "','" & Replace(strArtist, "'", "''") & "','" & strTitle & "','" & Replace(strAlbum, "'", "''") & "','" & Replace(strFrequency, "'", "''") & "','" & Replace(strBitrate, "'", "''") & "','" & Replace(strLength, "'", "''") & "','" & Replace(strTrack, "'", "''") & "')"
Cnn.Execute (SQL)
-
Apr 6th, 2002, 12:46 AM
#2
Isn't it mean to be " (one Chr(34)) and not ' ' (two Chr(39)s)?
-
Apr 6th, 2002, 12:56 AM
#3
Thread Starter
Fanatic Member
Can't do that
You get an unexpected separator syntax error.
-
Apr 6th, 2002, 01:03 AM
#4
What is the error you are getting?
I see your query string is all text type.
How about your field types in the SQL table?
Are they all text type too?
I forgot that there is in SQL, a setting for the single quote or something like that.
-
Apr 6th, 2002, 01:14 AM
#5
Thread Starter
Fanatic Member
Here's how my columns are set up...
VB Code:
' Create a new Table object.
With tbl
.Name = categories.txtcategory.Text
' Create fields and append them to the new Table
' object. This must be done before appending the
' Table object to the Tables collection of the
' Catalog.
.Columns.Append "FilePath", adVarWChar
.Columns.Append "FileName", adVarWChar
.Columns.Append "Filesize", adVarWChar
.Columns.Append "Artist", adVarWChar
.Columns.Append "Title", adVarWChar
.Columns.Append "Album", adVarWChar
.Columns.Append "Frequency", adVarWChar
.Columns.Append "Bitrate", adVarWChar
.Columns.Append "Length", adVarWChar
.Columns.Append "Track#", adVarWChar
End With
-
Apr 6th, 2002, 08:14 AM
#6
Thread Starter
Fanatic Member
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
|