怎样把在Form.FormShow事件中动态创建TAdoDataSet,连接数据库,open,并把所查询到的数据(string类型),写入一个数组,怎样实现?谢谢
解决方案 »
- 调试时,提示 Undeclared identifier: 'String'
- 如何从excel中读取数据,并保存到文本中?
- variant或IDispitch转换为指定class的问题
- 用query从table查询出来的结果可以修改吗?如何修改
- 『今天是我的生日,散分,同时也希望大家年终都满载而归!』
- 开发数据库程序怎么使用面向对象的分析和设计技术?
- 求助
- 用delphi + sqlserver 2000 应该用BDE 驱动好点还是用ADO好?各自优缺点(在线40分钟)
- 这个问题难道就没有人知道吗,再问一次。
- 新年第一个问题,假设你是大虾^-^.......
- 还是SQL.ADD(...)的问题
- 关于字串的加密问题
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, ADODB;type
TForm1 = class(TForm)
ADODataSet1: TADODataSet;
ADOConnection1: TADOConnection;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormShow(Sender: TObject);
begin
ADODataSet1.CommandText := 'slelct ....';
adoDataSet1.Connection := adoconnection1;
adoconnection1.open;
adodataset1.open;
while not adodataset1.Eof do
begin
数组[下标]:=adodataset.fieldByName('字段名').asString;
下标:= 下标+1;
adodataset1.next;
end;
end;end.
adodb,db;
var
adodataset:Tadodataset;
begin
adodataset:=Tadodataset.create(self);
ADODataSet.CommandText := 'slelct ....';
adoDataSet.Connectionstring := '';
adodataset.open;
while not adodataset.Eof do
begin
数组[下标]:=adodataset.fieldByName('字段名').asString;
下标:= 下标+1;
adodataset1.next;
end;
end;
很急,我要在弹出程序之前弹出一个小对话框来动态选择数据库连接,怎么来做
我用的delphi6,请帮忙,我的qq是23703867
油箱是:[email protected]
谢谢!
uses
……
type
TForm1 = class(TForm)
procedure FormShow(Sender: TObject);
private
{ Private declarations }
ADODataSet1: TADODataSet;
ADOConnection1: TADOConnection;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.FormShow(Sender: TObject);
begin
ADODataSet1:=TADODataSet.create(nil);
ADODataSet1.CommandText := 'slelct ....';
adoDataSet1.Connection := adoconnection1;
adoconnection1.open;
adodataset1.open;
while not adodataset1.Eof do
begin
数组[下标]:=adodataset.fieldByName('字段名').asString;
下标:= 下标+1;
adodataset1.next;
end;
end;end.
贴出来更好,谢谢各位高手啦!