Hi.
Anyone as frustrated as me???
Problem:
I have a created a command to return maximum id from myTable.., like this:
//--------------------------------------------------------------------------
----------------------------------------------------------------------------
-----
MySqlCommand cmd = new MySqlCommand(SELECT @PAR := MAX(ID) FROM myTable,
myConnection);
MySqlParameter param = new MySqlParameter();
param = cmd.Parameters.Add(@PAR, MySqlDbType.Int32, 4);
param.Direction = ParameterDirection.Output;
myConnection.Open();
cmd.ExecuteNonQuery();
int max_id = (int)cmd.Parameters[@PAR].Value;
myConnection.Close();
//--------------------------------------------------------------------------
----------------------------------------------------------------------------
----
This gives me an error -> error in SQL-Syntax.
I read the issue with use of ? instead of @, and Ive tried it all
!,
it keeps throwing exeptions like null values
Object reference not set to an instance of an object
and so on.
Anyone have a fail-proof method of creating a command with
return-parameters??
Thanks.
Reg.
Asbjørn Konstad
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.768 / Virus Database: 515 - Release Date: 22.09.2004