编辑: 通过其他语言随机搜索我找到了正确的答案,如果有人需要: “更新DataBase_Name设置Column ='”+ value +“'其中ID ='”+ value +“';”
我需要在列中插入数据,但无法在网上找到有关它的更多信息。
代码是
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
if (this->listBox1->SelectedIndex!=-1)
{
String^ constring = L"datasource=localhost;port=3306;username=root;password=root;";
MySqlConnection^ conDataBase = gcnew MySqlConnection(constring);
MySqlCommand^ cmdDataBase =
gcnew MySqlCommand(insert into products_shop.productname where idProductName='"+this-listBox1->SelectedItem->ToString()+"' ('ProductX','ProductY') values('"+this->textBox2-Text+","+this->textBox3->Text+"');",conDataBase);
MySqlDataReader^ MyReader;
try
{
conDataBase->Open();
MyReader = cmdDataBase->ExecuteReader();
}
catch(Exception^ex)
{
MessageBox::Show(ex->Message);
}
}
else
{
MessageBox::Show(L"Select an item please");
}
}
insert into products_shop.productname where idProductName='"+this->listBox1-SelectedItem-ToString()+"' ('ProductX','ProductY') values('"+this->textBox2-Text+","+this->textBox3-Text+"');
这一行只是我的randm猜测,有关语法应该如何实际的任何帮助?或者如果它的工作方式不同...... 谢谢你的帮助