Home All Groups Group Topic Archive Search About

Help get record count and moving forward and backwards!

Author
24 Feb 2006 10:46 PM
Adrian
Show quote Hide quote
> 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)
>
>

Author
25 Feb 2006 2:59 AM
Cyril Gupta
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
Author
25 Feb 2006 8:47 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
"Cyril Gupta" <nomail@nospam.com> schreef in bericht
news:Onp0fodOGHA.2336@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
>
Author
25 Feb 2006 8:53 PM
Adrian
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


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uY9LrfeOGHA.2888@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" <nomail@nospam.com> schreef in bericht
> news:Onp0fodOGHA.2336@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
> >
>
>