Is there a way to do something like this MySql.Data.MySqlClient.MySqlHelper.ExecuteScalar(sqlConn, SQL) with mysqldirect .net 3.05 as i do it with Mysql .Net Dataprovider? I need it because i want to get the max value of a specific field in my DataBase.
Sorry for my English
Please Help
execute select query in one line?
You can use MySqlCommand.ExecuteScalar() method to retrieve single value from query.
Code: Select all
MySqlCommand command = new MySqlCommand("select max(deptno) from dept", connection);
int maxDeptno = (int)command.ExecuteScalar();