Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Getting result of query within vb.net

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-18 : 13:39:27
I am trying to execute a query from .net. The query is just a count of a table: "SELECT Count(*) FROM Table1"

How do I get the result of the query into a variable? I don't need to set it to any kind of control.

Thanks,
Ninel

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-08-18 : 13:45:37
Dim cnt As Integer

cnSql.Open()
cnt = cmd.ExecuteScalar()
cnSql.Close()

Tara Kizer
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-18 : 13:54:33
Thank you so much, Tara.
It worked.
Go to Top of Page
   

- Advertisement -