The issue is the extra single quotes in the string. When the SQL parser runs into them it things that is the end of the value. But there is more so there is a SQL error. There are two ways to fix. The first (not the perfered) is to use a replace function like this:
The second way and the perfered is to use parameters in the command object.Code:cmd.CommandText = "INSERT INTO [Failed$] (OrderTime, Phone, MessageDetails) values ('" & Order_date & "','" & incomingtextno & "','" & textmsg.Replace("'","''") & "')"




Reply With Quote