delphi 显示数据

delphi 显示数据

 

 

标准动态 显示数据

 

procedure TForm1.Button2Click(Sender: TObject);
    var
   databasename:string;
   ip:string;
begin
  adoconnection1.Close;
  databasename:=ComboBox2.Text;//数据库
  ip:=ComboBox1.Text;//数据库服务器
 
  ADOquery1.SQL.Text:=ComboBox3.Text;
  ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog='+databasename+';Data Source='+ip;
  adoquery1.Connection:= ADOConnection1;
  ADOConnection1.Connected:=true;
  ADOquery1.SQL.Text:=ComboBox3.Text;//获取查询语句
  ADOquery1.Active:=true;
  datasource2.DataSet:=ADOquery1;
  dbgrid1.DataSource:=datasource2;


end;

你可能感兴趣的:(DELPHI技术)