>hi all,
>I'm trying to insert (and update) into an SQL Server table but I get an error when a name contains a ' e.g. Michael O'Reilly
>The code in summary is below, I've also tried variations of &lcName, (lcName) etc. but no joy
>
>lcSQLcommand = "INSERT into Contacts (" + ;
> "Contact_Name " + ;
> ")" + ;
> "Values (" + ;
> " '" + lcName + "'" + ;
> ")"
>
>SQLEXEC(lnSQLHandler, lcSQLcommand)
>
>~M
Try to use parameters instead:
text to lcSQLCommand noshow
Insert into Contacts ([Contact Name])
values (?m.lcName)
SQLEXEC(lnSQLHandler, lcSQLcommand)
If it's not broken, fix it until it is.
My Blog