You just have to use the "Update" method on myDa dataadapter. First you must create the update commands, the easiest way is to use "OledbCommandBuilder".
Code:Dim query As String = "Select Nome,Taxa,Valor,Data from view1 where Month(Data) = Month('" & a & "') and Nome ='" & ComboBox2.Text & "'" Dim cmd As New OleDbCommand(query, con) Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd) con.Open() Dim cmdbld As New OleDbCommandBuilder ' Add this line cmdbld.DataAdapter = myDa 'add this line myDA.Fill(myDataSet, "Data") View1DataGridView.DataSource = myDataSet.Tables("Data") ' No need to use Default view 'con.Close() ' Don't close the connection Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click myDa.Update(dt) End Sub




Reply With Quote