如题
按钮按下1的时候执行select * from a where a.[id] =:id; DBGrid显示a的内容
按钮按下2的时候执行select * from b where b.[id] =:id; DBGrid显示b的内容
最好有代码
按钮按下1的时候执行select * from a where a.[id] =:id; DBGrid显示a的内容
按钮按下2的时候执行select * from b where b.[id] =:id; DBGrid显示b的内容
最好有代码
解决方案 »
- FastReport如何动态设置页?
- 如何在ide里關閉某個try..except的錯誤提示?
- fastReport 导出Excel的问题
- SQL Server 不存在或拒絕存取??急用急用。幫幫小妹
- 如何取得动态创建的combobox的值
- 中国某著名通信企业H面试题
- 关于服务的超难问题,恐怕只有顶级delphi高手能解决!!!!
- http 500 内部服务器错误(救急)
- 怎样实现类似ie的地址栏的自动完成和自动加.com,.net功能?----内详!
- 大富翁论坛 是一个专门讨论Delphi的技术论坛,上面高手如云,是国内人气最盛、质量最高的Delphi讨论站?
- 急!
- ado+access的兼容问题^_^!
我想知道,buttonClick事件下面的代码如何写,就是让DBGrid重新绑定一次
begin
Query1.Close();
Query1.SQL.Text := 'select * from a where a.[id] =:id';
Query1.ParamByName('id').AsString := '1234';
Query1.Open();
end;procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Query1.Close();
Query1.SQL.Text := 'select * from b where b.[id] =:id';
Query1.ParamByName('id').AsString := '1234';
Query1.Open();
end;
ADOQuery.Active:= false;
ADOQuery.SQL.Clear;
ADOQuery.SQL.Add('select * from a where a.[id] =:id');
ADOQuery.Parameters.ParamByName('id').Value:= ?????????
ADOQuery.Prepared:= true;
ADOQuery.Active:= true;
2、在Button1的单击事件中:
ADOQuery.Active:= false;
ADOQuery.SQL.Clear;
ADOQuery.SQL.Add('select * from b where b.[id] =:id');
ADOQuery.Parameters.ParamByName('id').Value:= ?????????
ADOQuery.Prepared:= true;
ADOQuery.Active:= true;
--------------------------------------------------------------------
前提是,ADOQuery与DBGrid是绑定在一起的。
Shift: TShiftState);
begin
if key=49 then //如果是按'1'
begin
adoquery1.active:=false;
adoquery1.sql.text:='select * from a where a.[id] =:id' ;
adoquery1.parameters.ParamByName('ID').Value:=123;
adoquery1.active:=true;
end
if key=50 then //如果是按'2'
begin
adoquery1.active:=false;
adoquery1.sql.text:='select * from b where b.[id] =:id' ;
adoquery1.parameters.ParamByName('ID').Value:=123;
adoquery1.active:=true;
end
end;