I have a sql command that I get an error on the last entry my code looks like this
I get this error: on the last record only (it doesn't matter what it is. Now if I would take the last record and move it to the first it doesn't do it, but now the record I switch does it. So it is doing to the last record regardless of what the actual data is.)
Error: Synatax Error in string in query expression "
records is an array
For t = 0 To records.Length
command.CommandText = ""
command.CommandText = "Insert into table1(field1) values ('" & Replace$(realdata, "'", "''") & "')"
command.Connection = con
now the reason I have the replace function is because I have some ' in my data.
Now I eliminated the errors for the first couple of records, but everytime it hits the last record it gives me that error again. I used a debug.write(command.commandtext) and it looks like the insert line isn't putting in the ') at the end of the sql command.
so that is probrably what is wrong, but I cannot figure it out. Any ideas
why just the last record, any other ideas???
this is vb.net