且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从datagridview更新数据库

更新时间:2023-02-08 18:10:35

首先尝试


项目 - > DataSource然后继续,创建一个tableadapter,你的问题变得简单了。你可以尝试保存它,但保存意味着更新,插入和删除。 


https://msdn.microsoft.com/en-us/library/bb384426.aspx


connectdb1() conn.Open() CMD = New SqlCommand(RichTextBox1.SelectedText, conn) DR = CMD.ExecuteReader ds = New DataSet() dtb = New DataTable("mytable") ds.Tables.Add(dtb) ds.Load(DR, LoadOption.PreserveChanges, ds.Tables(0)) DataGridView1.DataSource = ds.Tables(0) Private Sub Btn_update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_update.Click **** i need help source code for update from datagridview End Sub

I will be very grateful if you want to help me for the code above

tanks,,

Try first

Project -> DataSource and then go on, create a tableadapter and your problem become easy. You can try to save it, but saving means update, insert and delete. 

https://msdn.microsoft.com/en-us/library/bb384426.aspx