给你一个adoconnection连接MSSQL SERVER数据库的例子;FRREPORT我没有用过,但连接数据库
的方式类似。
//从配置文件读取SQL SERVER设置信息
result:=false;
s:=ExtractFileDir(application.ExeName);
if s[length(s)]<>'/' then s:=s+'/';
s:=s+'Sqlset.ini';
if not fileexists(s) then
begin
application.MessageBox('在程序运行目录下找不到SQLSET.INI文件!','提示信息',48);
exit;
end;
try
r:=tinifile.Create(s);
except
application.MessageBox('无法读取数据库配置文件SQLSET.INI!'+#13+#13+'请先进行数据库设置!','错误信息',16);
r.free;
exit;
end;
adodb.close;
p:=pchar(r.ReadString('mssqlsvr','PWS',''));
s:='Provider=SQLOLEDB.1;Password=';
s:=s+cl_crypt32.cl_decrypt(p)+';Persist Security Info=True;User ID='+r.ReadString('mssqlsvr','USRNAME','')+';';
s:=s+'Initial Catalog='+r.ReadString('mssqlsvr','DBname','')+';Data Source='+r.ReadString('mssqlsvr','SVRIP','');
adodb.ConnectionString:=s; //ADO连接方式
r.free;
adodb.open;