DataGrid的问题,UP者有分

feifei10 2003-03-07 12:50:26
我在DataGrid中改掉的值如何保存到数据库?谢谢。
...全文
54 26 打赏 收藏 转发到动态 举报
写回复
用AI写文章
26 条回复
切换为时间正序
请发表友善的回复…
发表回复
beans2002 2003-04-29
  • 打赏
  • 举报
回复
up
colaxu 2003-04-29
  • 打赏
  • 举报
回复
up
lgh3328 2003-04-29
  • 打赏
  • 举报
回复
updata方法保存到数据库中就 可以哦
gaofang2079 2003-04-29
  • 打赏
  • 举报
回复
用Updata方法即可
sedan1983 2003-03-13
  • 打赏
  • 举报
回复
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#Top
timmy3310 2003-03-10
  • 打赏
  • 举报
回复
up
DannyChen 2003-03-10
  • 打赏
  • 举报
回复
up
hillwell 2003-03-10
  • 打赏
  • 举报
回复
up
e8007 2003-03-08
  • 打赏
  • 举报
回复
gz
Montaque 2003-03-07
  • 打赏
  • 举报
回复
public DataSet updateData (DataSet myDataSet,
string connString, string query) {
OleDbConnection myConn = new OleDbConnection (connString);
OleDbDataAdapter adapter = new OleDbDataAdapter ();
adapter.SelectCommand = new OleDbCommand (query, myConn);
OleDbCommandBuilder custCB = new OleDbCommandBuilder (adapter);
DataSet myDataSet = new DataSet ();

myConn.Open();
adapter.Fill (myDataSet);

// ... code to modify data in dataset here ...

// without the OleDbCommandBuilder this line would fail
adapter.Update(myDataSet);

myConn.Close();
return myDataSet;
}
Public Function updateData (myDataSet As DataSet, _
connString As String, query As String)
Dim myConn As New OleDbConnection (connString)
Dim adapter As New OleDbDataAdapter ()
adapter.SelectCommand = New OleDbCommand (query, myConn)
Dim custCB As New OleDbCommandBuilder (adapter)
Dim myDataSet As DataSet = New DataSet

myConn.Open()
adapter.Fill (myDataSet)

' ... code to modify data in DataSet here ...

' without the OleDbCommandBuilder this line would fail.
adapter.Update(myDataSet)

myConn.Close()
updateData = myDataSet
End Function
psxfghost 2003-03-07
  • 打赏
  • 举报
回复
当调用 Update 方法时,DataAdapter 将分析已作出的更改并执行相应的命令(INSERT、UPDATE 或 DELETE)。当 DataAdapter 遇到对 DataRow 的更改时,它将使用 InsertCommand、UpdateCommand 或 DeleteCommand 来处理该更改。这样,您就可以通过在设计时指定命令语法并在可能时通过使用存储过程来尽量提高 ADO.NET 应用程序的性能。在调用 Update 之前,必须显式设
~~~~~~~~~
置这些命令。如果调用了 Update 但不存在用于特定更新的相应命令(例如,
~~~~~~~~~~
不存在用于已删除行的 DeleteCommand),则将引发异常。

ms-help://MS.NETFrameworkSDK.CHS/cpguidenf/html/cpconupdatingdatabasewithdataadapterdataset.htm
psxfghost 2003-03-07
  • 打赏
  • 举报
回复
与数据集绑定,修改完后更新数据集就是了
wangjingjing390 2003-03-07
  • 打赏
  • 举报
回复
up
dragontt 2003-03-07
  • 打赏
  • 举报
回复
UP
DIVES 2003-03-07
  • 打赏
  • 举报
回复
UP
pengy2001 2003-03-07
  • 打赏
  • 举报
回复
关注!
SW515 2003-03-07
  • 打赏
  • 举报
回复
http://chs.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx

狂爽!!!
青团子 2003-03-07
  • 打赏
  • 举报
回复
up
zxn1979125 2003-03-07
  • 打赏
  • 举报
回复
up
aaxu 2003-03-07
  • 打赏
  • 举报
回复
UP
加载更多回复(6)

110,502

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧