问:错误C2227:' - > listView1'的左边必须指向class / struct / union / generic类型

时间:2016-09-27 10:16:03

标签: arrays visual-studio-2012 c++-cli

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;

1 个答案:

答案 0 :(得分:0)

>>> from decimal import Decimal
>>> '{:010.4f}'.format(Decimal('10.0040'))
'00010.0040'
>>> '{:010.4f}'.format(Decimal('-10.0040'))
'-0010.0040'

你的MyForm2声明有问题。最有可能的是你没有MyForm2^ myform2 = gcnew MyForm2(); ... myform2->listView1->FocusedItem->ListView 。您可能还会收到有关#include "MyForm2.h"的错误消息。

相关问题