How to escape forward slash?
- by AndrewB
I have the following sql command through code and because the parameter contains a forward slash when I evaluate the sql row after the update the column is just empty.
sqlCommand.CommandText = String.Format("update {0} set {1}='{2}'where id = @Id",
tableName, ColumnName, forwardSlashText);
sqlCommand.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value = rowId;
numRowsAffected = sqlCommand.ExecuteNonQuery();
adding a log.debug to this command i get the following output...
update my_table_name set
mime_type='application/pdf' where id =
@Id
So i would assume that the command is correct, but then looking at the row the mime_type column is empty.