i want to insert to a sql table a string that might contain ' character.
what is my best way to do so ? should i insert a \ before the ' ? here's my command in a c# code:
SqlCommand myCommand = new SqlCommand(
String.Format(
"insert into ACTIVE.dbo.Workspaces_WsToRefile values({0},'{1}',getdate())",
folderId,
NewWorkspaceName),
myConnection);
where NewWorkspaceName might contain ' character, so the insert will cause an exception at the moment.
thanks in advanced, hadas.
"hi'); DELETE FROM Users; --"?