delphi dm.ADOQuery1:missing SQL property
procedureTRptSingle.btnSchClick(Sender:TObject);varstr1,str2,str3,str4,strGuid2:Strin...
procedure TRptSingle.btnSchClick(Sender: TObject);
var
str1, str2, str3, str4, strGuid2: String;
strGuid1: TGUID;
begin
str1 := 'select b.ID_,b.sequence_,b.Code_,b.Name_,b.Spec_,'
+'b.Unit_,b.Count_ ,h.DocumentDate_,h.Number_,h.Sort_,h.Personnel_ '
+'from Single_Head h join Single_Body b on h.ID_ = b.ID_ where 1 = 1 ';
ADOQuery1.Open;
if chkCode.Checked then
str2 := Format(' and Code_ = ''%s''', [Trim(edtCode.Text)]);
if chkSort.Checked then
str3 := Format(' and Sort_ = ''%s''', [Trim(edtSort.Text)]);
if chkName.Checked then
str4 := Format(' and Name_ = ''%s''', [Trim(edtName.Text)]);
ADOQuery1.SQL.Text := str1 + str2 + str3 + str4;
ADOQuery1.Post;
DateTimePicker1.Date := StrToDate(FormatDatetime('yyyy/mm',now)+'/01');
DateTimePicker2.Date := StrToDate(FormatDateTime('yyyy/mm', now)+'/01');
if CreateGUID(strGuid1) = S_OK then
strGuid2 := GUIDToString(strGuid1);
ADOQuery1.FieldByName('ID_').AsString := strGuid2;
请问这是什么原因? 展开
var
str1, str2, str3, str4, strGuid2: String;
strGuid1: TGUID;
begin
str1 := 'select b.ID_,b.sequence_,b.Code_,b.Name_,b.Spec_,'
+'b.Unit_,b.Count_ ,h.DocumentDate_,h.Number_,h.Sort_,h.Personnel_ '
+'from Single_Head h join Single_Body b on h.ID_ = b.ID_ where 1 = 1 ';
ADOQuery1.Open;
if chkCode.Checked then
str2 := Format(' and Code_ = ''%s''', [Trim(edtCode.Text)]);
if chkSort.Checked then
str3 := Format(' and Sort_ = ''%s''', [Trim(edtSort.Text)]);
if chkName.Checked then
str4 := Format(' and Name_ = ''%s''', [Trim(edtName.Text)]);
ADOQuery1.SQL.Text := str1 + str2 + str3 + str4;
ADOQuery1.Post;
DateTimePicker1.Date := StrToDate(FormatDatetime('yyyy/mm',now)+'/01');
DateTimePicker2.Date := StrToDate(FormatDateTime('yyyy/mm', now)+'/01');
if CreateGUID(strGuid1) = S_OK then
strGuid2 := GUIDToString(strGuid1);
ADOQuery1.FieldByName('ID_').AsString := strGuid2;
请问这是什么原因? 展开
展开全部
这样就行了,前提 是 ADOQuery1已经设置正确的连接
ADOQuery1.sql.text := 'select b.ID_,b.sequence_,b.Code_,b.Name_,b.Spec_,'
+'b.Unit_,b.Count_ ,h.DocumentDate_,h.Number_,h.Sort_,h.Personnel_ '
+'from Single_Head h join Single_Body b on h.ID_ = b.ID_ where 1 = 1 ';
ADOQuery1.Open;
ADOQuery1.sql.text := 'select b.ID_,b.sequence_,b.Code_,b.Name_,b.Spec_,'
+'b.Unit_,b.Count_ ,h.DocumentDate_,h.Number_,h.Sort_,h.Personnel_ '
+'from Single_Head h join Single_Body b on h.ID_ = b.ID_ where 1 = 1 ';
ADOQuery1.Open;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询