Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

How to read SQL Server COUNT from SqlDataReader

string sql = "SELECT COUNT(*) FROM [DB].[dbo].[myTable]";
SqlCommand cmd = new SqlComman(sql, connectionString);
int count = (int)cmd.ExecuteScalar();
 
PREVIOUS NEXT
Tagged: #How #read #SQL #Server #COUNT #SqlDataReader
ADD COMMENT
Topic
Name
3+9 =