Použijte SqlCommand.ExecuteScalar() a přeneste jej do int
:
cmd.CommandText = "SELECT COUNT(*) FROM table_name";
Int32 count = (Int32) cmd.ExecuteScalar();
Použijte SqlCommand.ExecuteScalar() a přeneste jej do int
:
cmd.CommandText = "SELECT COUNT(*) FROM table_name";
Int32 count = (Int32) cmd.ExecuteScalar();