2016-09-27 89 views
-1
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { 
    MyForm2^ myform2 = gcnew MyForm2(); 
    String^ constring = L"datasource=localhost;port=3306;username=root;password=root"; 
    MySqlConnection^ conDataBase = gcnew MySqlConnection(constring); 
    MySqlCommand^ cmdDataBase = gcnew MySqlCommand(
     "Update librarysystem.bookdetails set isbn = '" + this->textBox1->Text + 
      "', booktitle = '" + this->textBox2->Text + 
      "', bookauthor = '" + this->textBox3->Text + 
      "', bookcategory = '" + this->comboBox1->SelectedItem + 
      "', bookedition = '" + this->textBox5->Text + 
      "', booknumofcopies = '" + this->textBox4->Text + 
      "' where isbn = '" + myform2->listView1->FocusedItem->ListView + "' ;", 
     conDataBase); 
    MySqlDataReader^ myReader; 

回答

0
MyForm2^ myform2 = gcnew MyForm2(); 
... 
myform2->listView1->FocusedItem->ListView 

有一些問題與您MyForm2的聲明。最有可能的是你沒有#include "MyForm2.h"。您可能也收到有關'MyForm2' : undeclared identifier的錯誤。

+0

謝謝你的信息,我應該怎麼做,或者我應該如何將myform2聲明爲myform16,因爲它們應該連接到我的listview工具 –

相關問題