问:错误C2227:左“ - > ListView1的”必须指向类/结构/联合/通用型
问题描述:
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;
答
MyForm2^ myform2 = gcnew MyForm2();
...
myform2->listView1->FocusedItem->ListView
有一些问题与您MyForm2的声明。最有可能的是你没有#include "MyForm2.h"
。您可能也收到有关'MyForm2' : undeclared identifier
的错误。
谢谢你的信息,我应该怎么做,或者我应该如何将myform2声明为myform16,因为它们应该连接到我的listview工具 –