请问为何在我的机器里写的ADO连数据库的程序在别人的机上就不行? 直接用ado连接的远程sql server 2K,就一个应用程序,在我的机器上很好(本机有delphi环境),但在别人的机器上没有delphi环境的就报连不上服务器,是不是程序编译时还需要加什么东西上去? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你应该检查一下你程序中连接sql server 2K的方式,以及sql server 2K的安全认证管理方式。 你是以什么方式联接数据库的,如果是ODBC,应配置ODBC 哥们和我的问题一样等着达者解决吧http://expert.csdn.net/Expert/topic/2597/2597618.xml?temp=.1880304 如果是用odbc的方式来连接的,还要在客户端配置好odbc如果是用ole的方式连接的,应该没问题了但是要注意把相应的 bpl 以及dll文件copy到客户端才可以midas.dll 等等 动态创建ADO的连接,使用相对路径就可以了AdoConn.Connected:=false;spath:=ExtractFilePath(Application.ExeName)+'\data\mlcz.mdb';AdoConn.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+spath+';Persist Security Info=False';AdoConn.Connected:=true; 1:odbc的问题,如果你用odbc连接的话!!!2:如果没有以用odbc连接是安全认证的问题你看看sql server的认证方式是什么?问题就在那里 如果用ODBC的话不用DLL,不过看看你的连接方式对否,是不是动态连接!!! 去那台没delphi 的机器上,装 ADO 的控件(或BDE 驱动)吧!!! uses inifiles;var inifile:tinifile; strconnection:string;//数据库连接字符串inifile:=tinifile.Create('c:\information.ini');//打开ini文件//读出ini文件的数据库配置信息strconnection:='Provider='+inifile.Readstring('数据库连接','Provider','')+';';strconnection:=strconnection+'Persist Security Info='+ inifile.Readstring('数据库连接','Persist Security Info','')+';';strconnection:=strconnection+ 'User ID='+inifile.Readstring('数据库连接','User ID','sa')+';';strconnection:=strconnection+ 'Initial Catalog='+ inifile.Readstring('数据库连接','Initial Catalog','')+';';if inifile.Readstring('数据库连接','Data Source','')<>'' then strconnection:=strconnection+ 'Data Source='+ inifile.Readstring('数据库连接','Data Source','')+';';strconnection:=strconnection+ 'Locale Identifier='+ inifile.Readstring('数据库连接','Locale Identifier','2052')+';';strconnection:=strconnection+ 'Connect Timeout='+ inifile.Readstring('数据库连接','Connect Timeout','15')+';';strconnection:=strconnection+ 'Use Procedure for Prepare='+ inifile.Readstring('数据库连接','Use Procedure for Prepare','1')+';';strconnection:=strconnection+ 'Auto Translate='+inifile.Readstring('数据库连接','Auto Translate','')+';';strconnection:=strconnection+ 'Packet Size='+inifile.Readstring('数据库连接','Packet Size','4096')+';';strconnection:=strconnection+ 'Workstation ID='+inifile.Readstring('数据库连接','Workstation ID','');//连接数据库with ADOConnection1 dobegin Connected:=false; ConnectionString:=strconnection; try connected:=true; except application.MessageBox('数据库联接错误!请执行数据库联接程序。','物业管理',MB_ICONERROR+mb_ok); application.Terminate;//退出程序 end; //end tryend;//end with下面是ini文件结构[数据库连接]Provider=SQLOLEDB.1Persist Security Info=FalseUser ID=saInitial Catalog=此处填写需要连接的数据库的名字Data Source=此处填写数据库所在的机器名字Locale Identifier=2052Connect TimeOut=10Use Procedure for Prepare=1Auto Translate=TruePacket Size=4096以后修改ini文件的内容就行啦,(修改机器名字),不需要修改程序,不需要设置odbc。 多谢各位!别人的机器是2K的机器,我用的是Ado方式,与ODBC无关吧?我在别人的机器上装了mdac2.8(微软主页上下的),就解决问题了。不过真的多谢各位了! delphi access数据库中存入图片路径 有关DBChart的问题 发动你们的智慧,帮我一起想想以下的报文到底是何种校验! 誰有Proxies的單元文件可以email一份給我啊 高分求助:如何才能显示和保存unicode字符?分不够可再加。谢谢! 谁能给我Delphi的密码!!!!! 读写文件速度很慢,如何解决? 请问这个错误是不是adoquery里的一个bug 请问,如何动态编辑AdoDataSet的CommandText属性? 帐号 如何将数据库中的某个字段的所有记录读入到一个ComboBox中? 用delphi怎么关闭所有打开MDI子窗体?
http://expert.csdn.net/Expert/topic/2597/2597618.xml?temp=.1880304
AdoConn.Connected:=false;
spath:=ExtractFilePath(Application.ExeName)+'\data\mlcz.mdb';
AdoConn.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+spath+';Persist Security Info=False';
AdoConn.Connected:=true;
是安全认证的问题
你看看sql server的认证方式是什么?
问题就在那里
var inifile:tinifile;
strconnection:string;//数据库连接字符串inifile:=tinifile.Create('c:\information.ini');//打开ini文件
//读出ini文件的数据库配置信息
strconnection:='Provider='+inifile.Readstring('数据库连接','Provider','')+';';
strconnection:=strconnection+'Persist Security Info='+ inifile.Readstring('数据库连接','Persist Security Info','')+';';
strconnection:=strconnection+ 'User ID='+inifile.Readstring('数据库连接','User ID','sa')+';';
strconnection:=strconnection+ 'Initial Catalog='+ inifile.Readstring('数据库连接','Initial Catalog','')+';';
if inifile.Readstring('数据库连接','Data Source','')<>'' then
strconnection:=strconnection+ 'Data Source='+ inifile.Readstring('数据库连接','Data Source','')+';';
strconnection:=strconnection+ 'Locale Identifier='+ inifile.Readstring('数据库连接','Locale Identifier','2052')+';';
strconnection:=strconnection+ 'Connect Timeout='+ inifile.Readstring('数据库连接','Connect Timeout','15')+';';
strconnection:=strconnection+ 'Use Procedure for Prepare='+ inifile.Readstring('数据库连接','Use Procedure for Prepare','1')+';';
strconnection:=strconnection+ 'Auto Translate='+inifile.Readstring('数据库连接','Auto Translate','')+';';
strconnection:=strconnection+ 'Packet Size='+inifile.Readstring('数据库连接','Packet Size','4096')+';';
strconnection:=strconnection+ 'Workstation ID='+inifile.Readstring('数据库连接','Workstation ID','');
//连接数据库
with ADOConnection1 do
begin
Connected:=false;
ConnectionString:=strconnection;
try
connected:=true;
except
application.MessageBox('数据库联接错误!请执行数据库联接程序。','物业管理',MB_ICONERROR+mb_ok);
application.Terminate;//退出程序
end; //end try
end;//end with下面是ini文件结构
[数据库连接]
Provider=SQLOLEDB.1
Persist Security Info=False
User ID=sa
Initial Catalog=此处填写需要连接的数据库的名字
Data Source=此处填写数据库所在的机器名字
Locale Identifier=2052
Connect TimeOut=10
Use Procedure for Prepare=1
Auto Translate=True
Packet Size=4096以后修改ini文件的内容就行啦,(修改机器名字),不需要修改程序,不需要设置odbc。
别人的机器是2K的机器,我用的是Ado方式,与ODBC无关吧?
我在别人的机器上装了mdac2.8(微软主页上下的),就解决问题了。
不过真的多谢各位了!