Is there an easier way to do this, besides loading data into a DataTable and using Rows.Count or using MySqlDataReader and iterating over all the given lines?
DataTable
Rows.Count
MySqlDataReader
if you cannot easily change the request
SELECT COUNT(*) FROM (<your complete query here>)
You can execute a query, for example:
SELECT COUNT(*) FROM MyTable;
You can use the MySQL information function FOUND_ROWS . Just run it right after the SELECT query. Like this:
FOUND_ROWS
SELECT
SELECT FOUND_ROWS()
Exec a
select count(*) from MyTable WHERE <clause>
and get the result using ExecuteScalar ()
Source: https://habr.com/ru/post/888339/More articles:Is it possible to kill WaitForSingleObject (handle, INFINITE)? - multithreadingObjects that are not displayed after moving them to the external jar package - javarefactoring large cursor queries by splitting into multiple cursors - oracleIs there any way to detect key registration software? - malware-detectioncan we use .each inside .each in jquery? - javascriptsuggestions for improving the implementation of the dispenser algorithm - c ++How to send daily email notification to users in PHP? - phpGoogle App Engine OAuth endpoints support OAuth 2.0? - authenticationPerformance, Java Generics - javaHow to set custom default color map in MATLAB? - propertiesAll Articles