N
Nathan Sokalski
I want to select only the first n records from a database using VB.NET. I
have declared a DataTable and OleDB.OleDbDataAdapter as follows:
Dim linkstable As New DataTable
Dim linksadapter As New OleDb.OleDbDataAdapter("SELECT * FROM worldnews
ORDER BY updated",
System.Configuration.ConfigurationManager.AppSettings("connectionstring"))
I want to use the Fill method, and I thought the following overload looked
like it might work:
Fill(startRecord As Integer,maxRecords As Integer,ParamArray dataTables As
DataTable())
The documentation describes the parameters as follows:
Parameters
startRecord
A DataTable to fill with records and, if necessary, schema.
maxRecords
The maximum number of records to retrieve.
dataTables
One of the CommandBehavior values.
The maxRecords parameter is obvious, and I assumed I would just use the
DataTable I wanted to fill for the dataTables parameter (in my case,
linkstable). However, I was confused by the startRecord parameter because it
is an Integer, but the description says that it is a DataTable. What should
I do to Fill the DataTable with only the first n records? I will also need a
way to Fill the DataTable with all the records other than the first n
records. Any ideas? Thanks.
have declared a DataTable and OleDB.OleDbDataAdapter as follows:
Dim linkstable As New DataTable
Dim linksadapter As New OleDb.OleDbDataAdapter("SELECT * FROM worldnews
ORDER BY updated",
System.Configuration.ConfigurationManager.AppSettings("connectionstring"))
I want to use the Fill method, and I thought the following overload looked
like it might work:
Fill(startRecord As Integer,maxRecords As Integer,ParamArray dataTables As
DataTable())
The documentation describes the parameters as follows:
Parameters
startRecord
A DataTable to fill with records and, if necessary, schema.
maxRecords
The maximum number of records to retrieve.
dataTables
One of the CommandBehavior values.
The maxRecords parameter is obvious, and I assumed I would just use the
DataTable I wanted to fill for the dataTables parameter (in my case,
linkstable). However, I was confused by the startRecord parameter because it
is an Integer, but the description says that it is a DataTable. What should
I do to Fill the DataTable with only the first n records? I will also need a
way to Fill the DataTable with all the records other than the first n
records. Any ideas? Thanks.