How to check if my table is empty from C#?
I have something like:
public MySqlConnection con;
public MySqlCommand cmd;
con = new MySqlConnection(GetConnectionString());
con.Open();
cmd = new MySqlCommand("SELECT * FROM data;", con);
Or I don’t need to call SELECT statement?
You can use
COUNT(*)with noWHEREclose and see if exactly how many rows exist with the result.Or you can do a
SELECT (id) FROM tablenamewith noWHEREclause and if no rows are returned then the table is empty.