我在goodsForm的头文件里定义了str1~str7来接收goodsForm下输入的七个数据。再在此Form下使用。
str2~str4分别接收一个年,月,日;
str5~str7分别接收另一个年,月,日;
但在本窗体下我需要年/月/日 这样的形式。因此我用StrCat来实现。ShowMessage出来p4,q4是正确的 ,但运行到下一步就出现了“invalid pointer operation”的错误是怎么回事呢???
void __fastcall Tqingdan::FormCreate(TObject *Sender)
{
String p1,p2,p3,p4,q1,q2,q3,q4;
String d="/";
p1=StrPas(StrCat(goodsForm->str2.c_str(),d.c_str()));
p2=StrPas(StrCat(p1.c_str(),goodsForm->str3.c_str()));
p3=StrPas(StrCat(p2.c_str(),d.c_str()));
p4=StrPas(StrCat(p3.c_str(),goodsForm->str4.c_str()));
//ShowMessage(p4);
q1=StrPas(StrCat(goodsForm->str5.c_str(),d.c_str()));
q2=StrPas(StrCat(q1.c_str(),goodsForm->str6.c_str()));
q3=StrPas(StrCat(q2.c_str(),d.c_str()));
q4=StrPas(StrCat(q3.c_str(),goodsForm->str7.c_str()));
//ShowMessage(q4);
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Text="Select * from dbo.sale where salgname='"+goodsForm->str1+"' and saltime between '"+p4+"' and '"+q4+"'";
ADOQuery1->ExecSQL();
ADOQuery1->Active=true;

}