2
Reply

ACCESS database - GridView Select a subset of tuples & Update 1 at a time

Emmanuel Yannakoudakis

Emmanuel Yannakoudakis

Dec 24 2012 4:23 AM
1.9k

Here is the code I use and it appears to work well. My question is how do I get the newly edited values from the GridView and update the corresponding selected tuple.

Dim conX As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;    Data Source=|datadirectory|questions.mdb;  Jet OLEDB:Database Password=theh3t;    ")
Dim sel1 As String = "Select * from creds where Username like '" & TextBox1.Text.Trim & "'"
Dim commandX As New OleDbCommand()
commandX.Connection = conX
commandX.CommandText = sel1
commandX.CommandType = CommandType.Text
Try
  conX.Open()
  Dim adapterX As New OleDbDataAdapter(commandX)
  Dim tableX As New DataTable()
  adapterX.Fill(tableX)
  GridView1.DataSource = tableX
  GridView1.DataBind()
  Catch ex As Exception
  GridView1.EmptyDataText = "Unable to get records " & Err.Description
Finally
  conX.Close()
  conX = Nothing
End Try


Answers (2)