Page 1 of 1

execute select query in one line?

Posted: Mon 28 Nov 2005 17:28
by xterm
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

Posted: Tue 29 Nov 2005 13:16
by Serious
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();

Posted: Tue 29 Nov 2005 19:10
by xterm
Thank you very much.I have bought 2 weeks ago mysqldirect .net and i am very pleased.Keep the good try!!!