SqlCommand oCmd;
oCmd.Connection.Open();
oCmd.CommandText="update Customers set CompanyName=str2,ContactName=str3 where CustomerID='"+str1+"'";
oCmd.ExecuteNonQuery();
为何报错,无效的列名 str2,str3敬请各位大哥大姐帮帮小弟
oCmd.Connection.Open();
oCmd.CommandText="update Customers set CompanyName=str2,ContactName=str3 where CustomerID='"+str1+"'";
oCmd.ExecuteNonQuery();
为何报错,无效的列名 str2,str3敬请各位大哥大姐帮帮小弟
oCmd.CommandText="update Customers set CompanyName='"+str2+"',ContactName='"+str3+"' where CustomerID='"+str1+"'";
改成
oCmd.CommandText="update Customers set CompanyName="+str2+",ContactName="+str3+" where CustomerID="+str1;另外:SqlCommand oCmd;
改成
SqlCommand oCmd=new SqlCommand();