What is the syntax for Parameters and C++.NET
Posted by: Gary Slovikosky
Date: February 28, 2006 04:17PM

Hi all,

I can't find any documentation about using parameters with C++.NET. I am trying the following but the VB.NET or C# equivalents don't work when I try to translate them.

using namespace MySql::Data;
using namespace MySql::Data::MySqlClient;


MySqlConnection * conn = new MySqlConnection() ;
MySqlCommand * cmd = new MySqlCommand() ;

String * SQLCommand ;
String * TextField ;
UInt32 ID ;
UInt32 Type ;

conn->ConnectionString = "server=localhost;uid=MyID;pwd=MyPWD";

conn->Open() ;

SQLCommand = "INSERT INTO MyDATABASE.MyTABLE VALUES(1, 'TryText', 25) ;

cmd->Connection = conn ;
cmd->CommandText = SQLCommand ;

cmd->ExecuteNonQuery() ;

conn->Close() ;


// OK, THE ABOVE WORKS AND WILL INSERT INTO THE TABLE THE VALUES 1, "TryText", 25

// NOW I WANT TO SUBSTITUTE PARAMETERS INTO THE INSERT STATEMENT SO THAT I CAN LOOP AND DO MULTIPLE INSERTS.

I have worked with some of the following but can't get anything to work.

MySqlParameter * param1 = new MySqlParameter("ID", MySqlDbType::UInt64) ;
param1 = cmd->CreateParameter() ;


Regards,

Gary Slovikosky

Options: ReplyQuote


Subject
Written By
Posted
What is the syntax for Parameters and C++.NET
February 28, 2006 04:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.