ADOQuery的一个问题,各位大大帮帮忙...
String no = Label3->Caption;String date = Label2->Caption;String content = Memo1->Lines->GetText();String amount = Form1->Edit1->Text;String chief = Edit1->Text;String accounting = Edit2->Text;String cashier = Edit3->Text;String charge = Edit4->Text;try{ADOConnection1->Open();ADOQuery1->SQL->Clear();ADOQuery1->Parameters->Clear();ADOQuery1->Parameters->CreateParameter("p0",ftString,pdInput,20,NULL);ADOQuery1->Parameters->CreateParameter("p1",ftString,pdInput,20,NULL);ADOQuery1->Parameters->CreateParameter("p2",ftString,pdInput,200,NULL);ADOQuery1->Parameters->CreateParameter("p3",ftString,pdInput,20,NULL);ADOQuery1->Parameters->CreateParameter("p4",ftString,pdInput,20,NULL);ADOQuery1->Parameters->CreateParameter("p5",ftString,pdInput,20,NULL);ADOQuery1->Parameters->CreateParameter("p6",ftString,pdInput,20,NULL);ADOQuery1->Parameters->CreateParameter("p7",ftString,pdInput,20,NULL);String sql="insert into receipt values(:p0,:p1,:p2,:p3,:p4,:p5,:p6,:p7)";//ADOQuery1->Parameters->ParamByName("p2")->Value=1;ADOQuery1->Parameters->ParamByName("p0")->Value=no;ADOQuery1->Parameters->ParamByName("p1")->Value=date;ADOQuery1->Parameters->ParamByName("p2")->Value=content;ADOQuery1->Parameters->ParamByName("p3")->Value=amount;ADOQuery1->Parameters->ParamByName("p4")->Value=chief;ADOQuery1->Parameters->ParamByName("p5")->Value=accounting;ADOQuery1->Parameters->ParamByName("p6")->Value=cashier;ADOQuery1->Parameters->ParamByName("p7")->Value=charge;ShowMessage(sql);ADOQuery1->SQL->Add(sql);ADOQuery1->ExecSQL();ADOQuery1->Close();ADOConnection1->Close();}catch(Exception &E){ShowMessage(E.Message);}