deliph连接数据库
时间:2011-09-24
来源:互联网
deliph连接数据库老是说连接属性错误,晕死了,求大师解决代码如下:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Grids,DBGrids,DB,ADODB,Stdctrls,ExtCtrls;
type
TForm1 = class(TForm)
vdbfname: TEdit;
Label1: TLabel;
Label2: TLabel;
vservername: TEdit;
Label3: TLabel;
vusername: TEdit;
Label4: TLabel;
upassword: TEdit;
vtablename: TComboBox;
Label5: TLabel;
bottom1: TButton;
botton2: TButton;
ADOConnection1: TADOConnection;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOTable1: TADOTable;
procedure buttom1click(sender:tobject);
procedure botton2click(sender:tobject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.buttom1click(sender: TObject);
var
s:string;
begin
adoconnection1.Connected:=false;
s:='Provider=SQLOLEDB.1;Password='+trim(upassword.text)+';Persist Security Info=True;';
s:=s+'User ID='+trim(vusername.text)+';Initial Catalog='+trim(vdbfname.text)+';Data Source='+trim(vservername.text)+';';
s:=s+'Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;';
s:=s+'Use Encryption for Data=False;Tag with column collation when possible=False';
adoconnection1.connectionstring:=s;
adoconnection1.loginprompt:=false;
adoconnection1.connectiontimeout:=3;
adoconnection1.connected:=true;
adotable1.Active:=false;
adotable1.Connection:=adoconnection1;
adotable1.TableName:=trim(vtablename.Text);
adotable1.Active:=true;
datasource1.DataSet:=adotable1;
dbgrid1.datasource:=datasource1;
vservername.SetFocus;
end;
procedure tform1.botton2click(sender: TObject);
begin
close;
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Grids,DBGrids,DB,ADODB,Stdctrls,ExtCtrls;
type
TForm1 = class(TForm)
vdbfname: TEdit;
Label1: TLabel;
Label2: TLabel;
vservername: TEdit;
Label3: TLabel;
vusername: TEdit;
Label4: TLabel;
upassword: TEdit;
vtablename: TComboBox;
Label5: TLabel;
bottom1: TButton;
botton2: TButton;
ADOConnection1: TADOConnection;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOTable1: TADOTable;
procedure buttom1click(sender:tobject);
procedure botton2click(sender:tobject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.buttom1click(sender: TObject);
var
s:string;
begin
adoconnection1.Connected:=false;
s:='Provider=SQLOLEDB.1;Password='+trim(upassword.text)+';Persist Security Info=True;';
s:=s+'User ID='+trim(vusername.text)+';Initial Catalog='+trim(vdbfname.text)+';Data Source='+trim(vservername.text)+';';
s:=s+'Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;';
s:=s+'Use Encryption for Data=False;Tag with column collation when possible=False';
adoconnection1.connectionstring:=s;
adoconnection1.loginprompt:=false;
adoconnection1.connectiontimeout:=3;
adoconnection1.connected:=true;
adotable1.Active:=false;
adotable1.Connection:=adoconnection1;
adotable1.TableName:=trim(vtablename.Text);
adotable1.Active:=true;
datasource1.DataSet:=adotable1;
dbgrid1.datasource:=datasource1;
vservername.SetFocus;
end;
procedure tform1.botton2click(sender: TObject);
begin
close;
end;
end.
作者: cllmxy 发布时间: 2011-09-24
用什么 ADO 连数据库啊。你下个组件, UniDac 支持多种数据库,无需配 ODBC
下载地址
http://download.csdn.net/detail/netcreate/3517299
下载地址
http://download.csdn.net/detail/netcreate/3517299
作者: netcreate 发布时间: 2011-09-24
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28