📜  如何从 SqlDataReader 读取 SQL Server COUNT - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:19.910000             🧑  作者: Mango

代码示例1
string sql = "SELECT COUNT(*) FROM [DB].[dbo].[myTable]";
SqlCommand cmd = new SqlComman(sql, connectionString);
int count = (int)cmd.ExecuteScalar();