精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
9.23PLEO 09:07:27
代码应该很简单,你复制一下,我实现了,就给你转
回复编程慧助 09:08:30
用ado.net的sqlcommand,发送update 语句,很容易实现啊
回复编程慧助 09:09:02
ado.net SQL语句里的update语句,这些你有印象吗?
回复9.23PLEO 09:09:15
我知道,大概的我懂,但是代码总是出错,所以我要全部的代码,
回复编程慧助 09:09:52
我给你找段代码,或者你把你出错的代码发给我,我给你解决下
回复9.23PLEO 09:10:52
你复制过来全部的代码吧,或者你写也写,主要是数据库的连接,还有插入数据的语句
回复编程慧助 09:15:00
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;回复编程慧助 09:15:34
this.sqlUpdateCommand1.CommandText = @"UPDATE [Order Details] SET OrderID = @OrderID, ProductID = @ProductID, UnitPrice = @UnitPrice, Quantity = @Quantity, Discount = @Discount WHERE (OrderID = @Original_OrderID) AND (ProductID = @Original_ProductID) AND (Discount = @Original_Discount) AND (Quantity = @Original_Quantity) AND (UnitPrice = @Original_UnitPrice); SELECT OrderID, ProductID, UnitPrice, Quantity, Discount FROM [Order Details] WHERE (OrderID = @OrderID) AND (ProductID = @ProductID)";编程慧助 09:15:43
比如update [1] set 2='2'回复编程慧助 09:16:15
using (SqlConnection connection = new SqlConnection( connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Connection.Open(); command.ExecuteNonQuery(); }回复9.23PLEO 09:17:50
using (SqlConnection connection = new SqlConnection( connectionString)) { string queryString=string.Format("update msg set message='{0}'",edt.Text); SqlCommand command = new SqlCommand(queryString, connection);command.Connection.Open(); command.ExecuteNonQuery(); }回复9.23PLEO 09:22:15