views:

176

answers:

1

Ive seen tutorials on the net on how to do it, but the tutorial is not applicable on the program that I wish to do. The tutorial tells you to add 4 navigation buttons so that you can navigate the database(first, last, back, and forward). Then an update and delete button. But if this is what I will do, it would take 10 years to navigate the database and update a record. Now, what I want to do is just for the user to input a unique ID and click search button(which I have already done). Then the update would be easier. How can I update or delete a record using this method?

+2  A: 

Something along these lines:-

Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDatabase.mdb;User Id=admin;Password=;")
Dim cmd As New OleDbCommand
Dim _ID as Integer=1 

cmd.Connection = cnn
cmd.CommandType = CommandType.Text
cmd.CommandText = "DELETE FROM blah WHERE primarykey=" & _ID
Using cnn
   cnn.open()
   cmd.ExecuteNonQuery()
End Using
Doogie