Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

for example i have a query like this:

 

MyCommand = New OleDbCommand("SELECT id FROM games", MyConnection)

 

Now i need to know how i can get the number of rows that is selected, so an integer number.

 

 

And my second question is. A structual problem :)

If i have multible rows that are selected then i do

while MyCommand.read

..

End While

 

Now what is the best way to get the values if i only SELECT 1 row?

Posted
Hi,

 

for example i have a query like this:

 

MyCommand = New OleDbCommand("SELECT id FROM games", MyConnection)

 

Now i need to know how i can get the number of rows that is selected, so an integer number.

 

 

And my second question is. A structual problem :)

If i have multible rows that are selected then i do

while MyCommand.read

..

End While

 

Now what is the best way to get the values if i only SELECT 1 row?

 

 

MyCommand = New OleDbCommand("SELECT Count(*) FROM games", MyConnection)

"In the immortal words of Socrates, who said "' I drank what?!'"
Posted

To Lemon:

 

How 'bout inserting the result from executing the "MyCommand = ..." into a dataset, then you can get the number of rows using:

 

Dim num as Integer = MyDataSet.rows.Count;

 

~kindOfForgotTheMethodToUse :)

Amir Syafrudin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...