Can you provide a code that causes this error. You have mentioned using tag that asp.net 4 is used. It is really hard to achieve such behavior using framework.
Generally speaking, it is recommended to use prepared statements to execute the query.
For example, if SQLCommand is used - the code could be
command->CommandText = S"insert into Region (RegionID, RegionDescription) values (@id, @desc)" ;
command->Parameters->Add (S"@id", __box(id));
command->Parameters->Add (S"@desc", desc);
command->Prepare();
command->ExecuteNonQuery();
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.prepare(v=vs.71).aspx[
^]