那位高手能解决,编译没有错误,却不显示数据
procedure TForm1.Button1Click(Sender: TObject);begin
qrysel:=TADOQuery.Create(nil);
try
qrysel.ConnectionString :='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=test_ccerp;Data Source=192.168.16.229;'; //设置连接串
//qrysel.ConnectionString := TADOConnection;
with qrysel do
begin
qrysel.Active:=false;
qrysel.close;
qrysel.sql.clear;
qrysel.sql.add('select * from bmdoc');
try
qrysel.Open;
//qrysel.execsql;
//qrysel.Next;
DataSource1.DataSet:=qrysel;
DBGrid1.DataSource:=DataSource1;
DBGrid1.Align := alClient;
qrysel.Active:=True;
except
showmessage('error');
end;
end;
finally
qrysel.free;
end;
end;