execute select query in one line?

execute select query in one line?

Postby xterm » Mon 28 Nov 2005 17:28

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
xterm
 
Posts: 9
Joined: Tue 15 Nov 2005 13:24

Postby Serious » Tue 29 Nov 2005 13:16

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();
Serious
 

Postby xterm » Tue 29 Nov 2005 19:10

Thank you very much.I have bought 2 weeks ago mysqldirect .net and i am very pleased.Keep the good try!!!
xterm
 
Posts: 9
Joined: Tue 15 Nov 2005 13:24


Return to dotConnect for MySQL