Answer the question
In order to leave comments, you need to log in
Why can't get the number of rows from the table?
Hello everyone, I want to write the number of all rows of the table into a variable (at the moment there are 6 of them). But instead of 6, -1 is written. Here is the code:
private void button3_Click(object sender, EventArgs e)
{
command = "SELECT COUNT(*) FROM clients;";
SQLiteCommand com1 = new SQLiteCommand(command,connection);
connection.Open();
count = com1.ExecuteNonQuery();
connection.Close();
MessageBox.Show(Convert.ToString(count));
}
Answer the question
In order to leave comments, you need to log in
Understand what the ExecuteNonQuery method does . In this case, it doesn't work for you. Most likely you need ExecuteScalar .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question