SQL数据库的一个表没有主键,C#无法可能无法自动更新,请问要怎么办?如何手动更新?我是新手,有具体的资料吗?给个链接也好。请高手指点。
原贴地址:
http://topic.csdn.net/u/20110723/10/0d9bf468-d6e4-4485-9c7d-5b213cf5cafb.html
原贴地址:
http://topic.csdn.net/u/20110723/10/0d9bf468-d6e4-4485-9c7d-5b213cf5cafb.html
2.即使不设逐渐也是可以更新的,SqlDataAdapter有其限制.不设主键不可以更新.
你可以自己手动写T-SQL 用SqlCommand去更新.
什么是T-SQL?如何写?能说的清楚一点吗?
SqlConnection conn = new SqlConnection("这里是你的数据库连接字符串");
conn.Open();
string sql= "update table set id =1 where..." SqlCommand com = new SqlCommand(sql, conn);
com.ExecuteNonQuery();
数据库的地址我在开始已经写了。
http://topic.csdn.net/u/20110723/10/0d9bf468-d6e4-4485-9c7d-5b213cf5cafb.html感谢大家支持!!