con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Seth Hall\My Documents\Visual Studio 2005\Projects\Lunchout Server\Lunchout Server\agentinfo.mdb" con.Open() sql = "SELECT * FROM agents" da = New OleDb.OleDbDataAdapter(sql, con) da.Fill(ds, "agents") con.Close()
I have a DataGridView that I added to my form and I used its wizard or whatever its called to connect my access database to it. Now it displays my DB and everything I have my dataset as Agentinfodataset, my table adapter as agentstableadapter and then agentbindingsource etc.
Now this is my code to delete a selectedrow in the datagridview
Private Sub btndelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndelete.Click For Each row As DataGridViewRow In DataGridView1.SelectedRows DataGridView1.Rows.Remove(row) Next End Sub
But it wont save to the database. Im messed aroudn with Fill, Update, AcceptChanged, EndEdit and I just cant see to get to work. I looked around on google and still nothing. Any Ideas?