T
TDS News
Here's my code...
Private oConn As New OleDb.OleDbConnection()
Private oCommand As New OleDb.OleDbCommand()
Private oDataAdapter As New OleDb.OleDbDataAdapter()
Private oDataSet As New DataSet()
Public Event Err()
Public Sub Init()
Dim Row As DataRow
oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & Application.StartupPath & "\WinMUX.mdb;Persist Security
Info=False"
oCommand.CommandText = "SELECT Name FROM Objects"
oCommand.Connection = oConn
oCommand.CommandTimeout = 30
oDataAdapter.SelectCommand = oCommand
oDataAdapter.Fill(oDataSet, "Objects")
For Each Row In oDataSet.Tables("Objects").Rows
MsgBox(Row("Name"))
If Row("Name") = "Brimstone" Then
Row("Name") = "NotBrimstone"
End If
Next
oDataAdapter.Update(oDataSet, "Objects")
End Sub
I know it isn't the prettiest code but I'm just trying to figure this Data
Access stuff out in .NET. How do I update the data in the database with
what has been changed in the Dataset? I'm completely lost. With ADO you
used to just call the adoRecordset.Update method. What do you do now?
Andrew Cooper
(e-mail address removed)
Private oConn As New OleDb.OleDbConnection()
Private oCommand As New OleDb.OleDbCommand()
Private oDataAdapter As New OleDb.OleDbDataAdapter()
Private oDataSet As New DataSet()
Public Event Err()
Public Sub Init()
Dim Row As DataRow
oConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & Application.StartupPath & "\WinMUX.mdb;Persist Security
Info=False"
oCommand.CommandText = "SELECT Name FROM Objects"
oCommand.Connection = oConn
oCommand.CommandTimeout = 30
oDataAdapter.SelectCommand = oCommand
oDataAdapter.Fill(oDataSet, "Objects")
For Each Row In oDataSet.Tables("Objects").Rows
MsgBox(Row("Name"))
If Row("Name") = "Brimstone" Then
Row("Name") = "NotBrimstone"
End If
Next
oDataAdapter.Update(oDataSet, "Objects")
End Sub
I know it isn't the prettiest code but I'm just trying to figure this Data
Access stuff out in .NET. How do I update the data in the database with
what has been changed in the Dataset? I'm completely lost. With ADO you
used to just call the adoRecordset.Update method. What do you do now?
Andrew Cooper
(e-mail address removed)