By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,068 Members | 1,073 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,068 IT Pros & Developers. It's quick & easy.

Help get record count and moving forward and backwards!

P: n/a

Hi

I'm lost! so please help me...

I have the following code

I want to simply retrieve all the record that matches the SQL statement, I
want to know how many records matched and display only one field adata
from each match but also be able to step forward and backwards?!

Dim myConnection As MySqlConnection

Dim myDataAdapter As MySqlDataAdapter

Dim myDataSet As DataSet

Dim mySelectQuery As String = "SELECT aData FROM mydb.test where myNumber
like '%" & txtNum.Text & "%'"

Dim strSQL As String

Dim iRecordCount As Integer

myConnection = New MySqlConnection("server=localhost; user id=root;
password=password; database=mydb")

strSQL = mySelectQuery

myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)

myDataSet = New DataSet

myDataAdapter.Fill(myDataSet, "mydb.test ")

MsgBox(myDataSet.ExtendedProperties.Count.ToString )

Feb 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello,

In VB.Net there is no more a provision to move forwards and backwards in a
recordset. The most popular method is to retrieve the records in a DataTable
which exposes a DataRowCollection.

You can then access any record in the collection by its index.

Regards
Cyril Gupta
Feb 25 '06 #2

P: n/a
Cyril,

I am curious, the OP is not speaking about a recordset, where you get this?
In my opinion is the answer from Ken the right one about the count.

Getting a datarow in a datatable is just

dim dr as datarow = dt.table(0).Rows(The position index)
By changing the position index you can go get any datarow you want.

(To confuse, there are in the strongly typed dataset against members to do
movenext and moveprevious with a datatable).

Cor

"Cyril Gupta" <no****@nospam.com> schreef in bericht
news:On**************@TK2MSFTNGP12.phx.gbl...
Hello,

In VB.Net there is no more a provision to move forwards and backwards in a
recordset. The most popular method is to retrieve the records in a
DataTable which exposes a DataRowCollection.

You can then access any record in the collection by its index.

Regards
Cyril Gupta

Feb 25 '06 #3

P: n/a
Thanks, but Cor, I don't see a post from "Ken"?!

I didn't want to use a data grid as I don't know how many records it will
return (could in the millions) and don't want to display them in a grid...

If Ken's, missing, post has my answer could someone re post it for me
please!

thanks
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uY**************@tk2msftngp13.phx.gbl...
Cyril,

I am curious, the OP is not speaking about a recordset, where you get this? In my opinion is the answer from Ken the right one about the count.

Getting a datarow in a datatable is just

dim dr as datarow = dt.table(0).Rows(The position index)
By changing the position index you can go get any datarow you want.

(To confuse, there are in the strongly typed dataset against members to do
movenext and moveprevious with a datatable).

Cor

"Cyril Gupta" <no****@nospam.com> schreef in bericht
news:On**************@TK2MSFTNGP12.phx.gbl...
Hello,

In VB.Net there is no more a provision to move forwards and backwards in a recordset. The most popular method is to retrieve the records in a
DataTable which exposes a DataRowCollection.

You can then access any record in the collection by its index.

Regards
Cyril Gupta


Feb 25 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.