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)
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