【发布时间】:2011-11-14 05:59:44
【问题描述】:
地址文本框中有单引号和双引号。如何插入数据库。我正在使用 SQL2005。 我的代码如下...
str = "exec sp_cust_reg '" + customer.Cust_Id + "','" + customer.Cust_Name + "','" + customer.Gender + "','" + customer.Acc_no + "','" + customer.Address + "','" + customer.Pin_no + "','" + customer.Phone_no + "','" + customer.Mobile_no + "','" + customer.Email + "','" + customer.Authorise + "'";
地址是乔恩的家
它的Text Visualizer如下...
exec sp_cust_reg 'C7','George Joseph','Male','0001-212123','jo"hn's house','515151','04862787896','8888888888','johnyqw@gmail.com','N'
我用过
string sql = str.Replace("\'", " ");.
然后我得到
exec sp_cust_reg C7 , George Joseph , Male , 0001-212123 , jo"hn s house , 515151 , 04862787896 , 8888888888 , johnyqw@gmail.com , N
【问题讨论】:
标签: c# asp.net sql-server sql-server-2005