Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

what is the best way to return the total number of rows found in a query to SQL2k ?

 

i can connect and query, .. i'm just wondering the most efficient way to see if a user/pass row exists.

Posted

i guess i should be more specific. right now i'm creating a data adapter.. and filling a dataset. then i use rows.count on the data table in the dataset.

 

that seems like a lot of things to do just to get the number of rows found.

  • *Experts*
Posted
You need to set an alias for the COUNT.
SELECT COUNT(id) AS rowcount FROM mytable WHERE id = 7

Then use 'rowcount' as if it was a regular field.

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...