HI. I have this error
"non handled exception 'System.InvalidOperationException' incorelab.mysql.dll
added information : Connection property has not been initialized"
with this simple VC++.net program, at the line myCommand->ExecuteNonQuery();
#include "stdafx.h"
#using
#using
#using
#using
using namespace System;
using namespace System::Data;
using namespace CoreLab::MySql;
int main() {
String* q="INSERT INTO `accor` ( `date` , `open` , `high` , `low` , `close` ) VALUES ('2004-05-01', '10', '1', '1', '1')";
MySqlCommand *myCommand = new MySqlCommand(q);
MySqlConnection * cntd= new MySqlConnection("User=root;Host=localhost;Port=3306;Database=td");
cntd->Open();
myCommand->ExecuteNonQuery();
cntd->Close();
return 0;
}
Could you explained it to me. Strangely, it worked once, and then never ....
exception with ExecuteNonQuery();
Re: exception with ExecuteNonQuery();
You should add this row to your code:
Just it was specified in the exception: 'Connection property has not been initialized.'
Code: Select all
myCommand->Connection = cntd