public void updataCustomers(string CustomerID,string CompanyName,string ContactName,string Address)
{
SqlConnection cn=new SqlConnection ("server=localhost;database=NorthWind;user=mjc;password=123;");
SqlCommand cmd=new SqlCommand("updata Customers set CompanyName='"+ CompanyName+"',ContactName='"+ContactName+"',Address="'+Address+"'where CustomerID='"+CustomerID+""",cn);
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
还是不对,出现了第一行:‘Laurence’附近有语法错误。字符串‘’之前有未闭合的引号。
追答SqlCommand cmd=new SqlCommand("update Customers set CompanyName='"+ CompanyName+"',ContactName='"+ContactName+"',Address='"+Address+"' where CustomerID='"+CustomerID+"'",cn);////错误updata->update(标点符号问题 认真查看下)