1 Replies - 1077 Views - Last Post: 19 January 2009 - 07:14 PM Rate Topic: -----

#1 Sethro117  Icon User is offline

  • Still the sexiest mofo.
  • member icon

Reputation: 237
  • View blog
  • Posts: 2,378
  • Joined: 14-January 09

Updating DataGridView and Database

Posted 19 January 2009 - 06:27 PM

		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"

		sql = "SELECT * FROM agents"
		da = New OleDb.OleDbDataAdapter(sql, con)

		da.Fill(ds, "agents")


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
	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?

Is This A Good Question/Topic? 0
  • +

Replies To: Updating DataGridView and Database

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon

Reputation: 11617
  • View blog
  • Posts: 45,793
  • Joined: 12-June 08

Re: Updating DataGridView and Database

Posted 19 January 2009 - 07:14 PM

you have to take your dataset and use it as input for your adapter.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1