kittaiyya
April 8th, 2008, 08:11 PM
Hello There,
I am trying to insert variables in mysql database.
I have a Dialog based application which when clicked OK, inserts some data into the database
But i am getting this error "Parameter '?' must be defined."
Here is my code
CString ip_add="123.123.123";
MySqlConnection ^conn;
MySqlCommand ^cmd;
conn=gcnew MySqlConnection(L"Data Source=localhost;database=demographics;Persist Security Info=yes;uid=root;Password=toor");
cmd = gcnew MySqlCommand(L"Insert into user_demo(userid) values(?ip_add)", conn);
conn->Open();
cmd->ExecuteNonQuery();
MessageBox("hello",NULL,0);
conn->Close();
When i pass just values it works ok, but if i store the values in a variable and send it then it gives the Parameter ?ip_add must be defined
I am assuming that ? is the way of indicating that it is the variable and the original value of the variable needs to be sent.
Any kind of help would be appreciated
regards
Kittu
I am trying to insert variables in mysql database.
I have a Dialog based application which when clicked OK, inserts some data into the database
But i am getting this error "Parameter '?' must be defined."
Here is my code
CString ip_add="123.123.123";
MySqlConnection ^conn;
MySqlCommand ^cmd;
conn=gcnew MySqlConnection(L"Data Source=localhost;database=demographics;Persist Security Info=yes;uid=root;Password=toor");
cmd = gcnew MySqlCommand(L"Insert into user_demo(userid) values(?ip_add)", conn);
conn->Open();
cmd->ExecuteNonQuery();
MessageBox("hello",NULL,0);
conn->Close();
When i pass just values it works ok, but if i store the values in a variable and send it then it gives the Parameter ?ip_add must be defined
I am assuming that ? is the way of indicating that it is the variable and the original value of the variable needs to be sent.
Any kind of help would be appreciated
regards
Kittu