Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

return number of rows in table to textbox 1

Status
Not open for further replies.

chilly442

Technical User
Jun 25, 2008
151
US
I need to count how many rows are in a table, and then return that value to a textbox on a web form. Didn't find anything online that helped with this problem.

I guess what I really need is to get the number of rows via a query like:
SELECT Count(*)
FROM Events

But then how do I store that value into a variable?

Any ideas?

Help gets stars!
Thanks,
Chilly442
 
You can use a command object's ExecutScalar() method with the SQL you have written.

ex. Dimi x as integer = cmd.ExecuteNonScalar(...)
 
That worked perfect. Thanks for the help!!!

Chilly442
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top