B
Bernie Hunt
I'm working on the learning curve between ADO and ADO.net. I'm stuck at how
to work with unbound data, vs data bound to a grid. All the start up
references I've found show how to connect data to a grid. I need to process
individual rows, row by row.
I have this working as my sample;
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Create a connection string ...
Dim ConnectionString As String = "DSN=Eclipse"
' Create a Connection object and open it with the connection string
....
Dim conn As Connection = New Connection
Dim connMode As Integer = ConnectModeEnum.adModeUnknown
conn.CursorLocation = CursorLocationEnum.adUseClient
conn.Open(ConnectionString, "", "", connMode)
Dim recAffected As Object
Dim cmdType As Integer = CommandTypeEnum.adCmdText
' Execute sql statement to create recordset
Dim sql As String = "SELECT * From Payors ORDER BY PayerID ASC"
Dim rs As _Recordset = conn.Execute(sql)
' Create dataset and data adapter objects
Dim ds As DataSet = New DataSet("Recordset")
Dim da As OleDbDataAdapter = New OleDbDataAdapter
' Call data adapter's Fill method to fill data from ADO
' Recordset to the dataset
da.Fill(ds, rs, "OutputData")
' Now use dataset
DataGrid1.DataSource = ds.DefaultViewManager
End Sub
What I'd like to do is something like this;
' I want to do something like this
Do While Not rs.EOF
txbOutputBox.Text = rs("PayorID")
rs.MoveNext()
Loop
in place of binding the data to they DataGrid.
Any guidance or suggestions? Any references on the net where I can see this
done?
Thanks,
Bernie
to work with unbound data, vs data bound to a grid. All the start up
references I've found show how to connect data to a grid. I need to process
individual rows, row by row.
I have this working as my sample;
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' Create a connection string ...
Dim ConnectionString As String = "DSN=Eclipse"
' Create a Connection object and open it with the connection string
....
Dim conn As Connection = New Connection
Dim connMode As Integer = ConnectModeEnum.adModeUnknown
conn.CursorLocation = CursorLocationEnum.adUseClient
conn.Open(ConnectionString, "", "", connMode)
Dim recAffected As Object
Dim cmdType As Integer = CommandTypeEnum.adCmdText
' Execute sql statement to create recordset
Dim sql As String = "SELECT * From Payors ORDER BY PayerID ASC"
Dim rs As _Recordset = conn.Execute(sql)
' Create dataset and data adapter objects
Dim ds As DataSet = New DataSet("Recordset")
Dim da As OleDbDataAdapter = New OleDbDataAdapter
' Call data adapter's Fill method to fill data from ADO
' Recordset to the dataset
da.Fill(ds, rs, "OutputData")
' Now use dataset
DataGrid1.DataSource = ds.DefaultViewManager
End Sub
What I'd like to do is something like this;
' I want to do something like this
Do While Not rs.EOF
txbOutputBox.Text = rs("PayorID")
rs.MoveNext()
Loop
in place of binding the data to they DataGrid.
Any guidance or suggestions? Any references on the net where I can see this
done?
Thanks,
Bernie