本文介绍了sql连接字符串错误'无法识别的转义序列'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private void btnsv_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=tubd_data;Data Source=TIMY\SQLEXPRESS");
try
{
con.Open();
statusStrip1.Text="Connection Succesfull !!!";
SqlCommand cmd = con.CreateCommand();
cmd.CommandText="Insert into must_first [invoice_no], [date], [name], [total], [total_iv] values ('" + invo_no.Text + "','" + bill_datetxt.Text + "','" + txtname.Text + "','" + txttot.Text + "','" + txtvatinclu.Text + "')";
con.Close();
try
{
cmd.ExecuteNonQuery();
statusStrip1.Text="Record Updated!!!";
}
catch(Exception)
{
statusStrip1.Text="Record Update Error!!!";
}
}
catch(Exception)
{
statusStrip1.Text="Connection Fail !!!";
}
}
推荐答案
这篇关于sql连接字符串错误'无法识别的转义序列'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!