L
lanchong
Unregistered / Unconfirmed
GUEST, unregistred user!
类的定义:
type
Tdataconfig=class
myconn:tadoconnection;
myquery:tadoquery;
procedure dataconfig();
procedure open();
procedure close();
procedure openquery(str_sql:string);
procedure closequery();
procedure execquery(str_sql:string);
public
constructor create;
end;
下面引用时,在 myconn.LoginPrompt:=false;一行出错:
procedure tdataconfig.Open();
const
link_str='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=%s;Initial Catalog=%s;Data Source=%s';
begin
try
InitProgramMessage;
InitSystemWorkground;
myconn.LoginPrompt:=false;
myconn.Connected:=false;
myconn.ConnectionString:=Format(link_str,[RemoteDatabaseUser,RemoteDatabaseName,RemoteDatabaseServerName]);
myconn.Connected := True;
except Application.MessageBox('远程数据库连接失败!', '异常', MB_OK + MB_ICONINFORMATION);
end;
end;
type
Tdataconfig=class
myconn:tadoconnection;
myquery:tadoquery;
procedure dataconfig();
procedure open();
procedure close();
procedure openquery(str_sql:string);
procedure closequery();
procedure execquery(str_sql:string);
public
constructor create;
end;
下面引用时,在 myconn.LoginPrompt:=false;一行出错:
procedure tdataconfig.Open();
const
link_str='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=%s;Initial Catalog=%s;Data Source=%s';
begin
try
InitProgramMessage;
InitSystemWorkground;
myconn.LoginPrompt:=false;
myconn.Connected:=false;
myconn.ConnectionString:=Format(link_str,[RemoteDatabaseUser,RemoteDatabaseName,RemoteDatabaseServerName]);
myconn.Connected := True;
except Application.MessageBox('远程数据库连接失败!', '异常', MB_OK + MB_ICONINFORMATION);
end;
end;