chrisryhal
asked on
Using Special Character Strings With SQL And C#
Trying to insert some records with my ASP.NET app and noticed that I can't insert special characters. An example would be if I inserted "President" into the <TABLE>.Title column it works..............but if I type in "President's" its fails because of the " ' "
I know in VB.NET I used to do a
strSQLInsert = strSQLInsert & "'" & Trim(txtTitle.Text) & "',"
and thing I remember it working correctly. Any insight with C# is greatly appreciated.
I know in VB.NET I used to do a
strSQLInsert = strSQLInsert & "'" & Trim(txtTitle.Text) & "',"
and thing I remember it working correctly. Any insight with C# is greatly appreciated.
strSQLInsert = "INSERT INTO <TABLE>(Title,Address,City,State,Description,Type,UserID,Approved) values (";
strSQLInsert = strSQLInsert + "'" + txtTitle.Text + "',";
strSQLInsert = strSQLInsert + "'" + txtAddress.Text + "',";
strSQLInsert = strSQLInsert + "'" + txtCity.Text + "',";
strSQLInsert = strSQLInsert + "'" + cmbState.SelectedValue + "',";
strSQLInsert = strSQLInsert + "'" + txtDescription.Text + "',";
strSQLInsert = strSQLInsert + "'" + cmbDestinationType0.SelectedValue + "',";
strSQLInsert = strSQLInsert + "'" + siteUser.UserId + "',";
strSQLInsert = strSQLInsert + "'" + false + "')";
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tgerbert:
Thought you might shed some light on this one if possible
https://www.experts-exchange.com/questions/26091280/Object-must-implement-IConvertible.html
Thought you might shed some light on this one if possible
https://www.experts-exchange.com/questions/26091280/Object-must-implement-IConvertible.html
ASKER