关于安装ODBC Driver的问题(50分)

  • 主题发起人 raymondcen
  • 开始时间
R

raymondcen

Unregistered / Unconfirmed
GUEST, unregistred user!
我用wise制作安装程序。要在ODBC中import一个Data Source。
但是被安装的机器上没有SQL Server,所以还要Import一个SQL Server的Driver。
但是安装的时候却报错1918。
应该怎么配置呢?
 
S

smallsun007

Unregistered / Unconfirmed
GUEST, unregistred user!
在SQL Server安装盘中有Dcom95,你安装上它试试!
 
Q

qianwt

Unregistered / Unconfirmed
GUEST, unregistred user!
Function windowsdir:string;
const BufferSize = 144;
var ABuffer: array[0..BufferSize] of Char;
begin
if GetWindowsDirectory(PChar(@ABuffer), BufferSize) = 0 then
result := ''
else
result := StrPas(PChar(@ABuffer));
end;

procedure TForm1.Configodbcdb(s_name, s_servername: String);
var
reg: TRegistry;
s_driver: String;
begin
reg := TRegistry.Create;
memo1.lines.text := 'copy "'+extractfilepath(application.exename) +'odbc*.*" "'+windowsdir+'/system"';
memo1.Lines.text := memo1.lines.text+#13+'copy "'+extractfilepath(application.exename) +'sql*.*" "'+windowsdir+'/system"';
memo1.Lines.text := memo1.lines.text+#13+'copy "'+extractfilepath(application.exename) +'dbnmpntw.dll" "'+windowsdir+'/system"';
memo1.Lines.text := memo1.lines.text+#13+'copy "'+extractfilepath(application.exename) +'ds*gt.dll" "'+windowsdir+'/system"';
memo1.Lines.text := memo1.lines.text+#13+'copy "'+extractfilepath(application.exename) +'dbnmpntw.dll" "'+windowsdir+'/system"';
memo1.Lines.text := memo1.lines.text+#13+'copy "'+extractfilepath(application.exename) +'dbmssocn.dll" "'+windowsdir+'/system"';
memo1.lines.SaveToFile('odbc.bat');
winexec('odbc.bat',sw_hide);
with regdo
begin
RootKey := HKEY_LOCAL_MACHINE;
if openkey('software/microsoft/windows/currentversion/shareddlls',true) then
begin
writeinteger(windowsdir+'/system/odbc16gt.dll',3);
writeinteger(windowsdir+'/system/odbc32.dll',3);
writeinteger(windowsdir+'/system/odbc32gt.dll',3);
writeinteger(windowsdir+'/system/odbccp32.dll',3);
writeinteger(windowsdir+'/system/odbccp32.cpl',3);
writeinteger(windowsdir+'/system/odbccr32.dll',3);
writeinteger(windowsdir+'/system/odbcinst.cnt',3);
writeinteger(windowsdir+'/system/odbcinst.hlp',3);
writeinteger(windowsdir+'/system/odbcint.dll',3);
writeinteger(windowsdir+'/system/sqlsrv32.dll',5);
writeinteger(windowsdir+'/system/dbnmpntw.dll',3);
writeinteger(windowsdir+'/system/dbmssocn.dll',3);
end;
closekey;
if openkey('software/microsoft/MSSQLserver/client/connectto',true) then
begin
writestring('dsquery','dbnmpntw');
writestring(s_servername,'dbmssocn,'+s_servername+',1433');
end;
closekey;
if openkey('Software/ODBC/ODBCINST.INI/SQL Server',true) then
begin
s_driver:= windowsdir+'/system/sqlsrv32.dll';
writestring('driver',s_driver);
writestring('apilevel','2');
writestring('connectfunction','YYY');
writestring('cptimeout','60');
writestring('driverodbcver','03.50');
writestring('fileusage','0');
writestring('setup',s_driver);
writestring('sqllevel','1');
writeinteger('usagecount',1);
end;
closekey;
if openkey('software/odbc/odbc.ini/'+s_name,true) then
begin
WriteString('server',s_servername);
writestring('driver',s_driver);
writestring('lastuser','sa');
end;
CloseKey;
if openkey('software/odbc/odbc.ini/ODBC Data Sources',true) then
writestring(s_name,'SQL Server');
closekey;
if openkey('software/odbc/odbcinst.ini/odbc drivers',true) then
writestring('sql server','installed');
closekey;
end;
reg.free;
end;
 
R

raymondcen

Unregistered / Unconfirmed
GUEST, unregistred user!
多人接受答案了。
 

Similar threads

D
回复
0
查看
730
DelphiTeacher的专栏
D
D
回复
0
查看
702
DelphiTeacher的专栏
D
D
回复
0
查看
672
DelphiTeacher的专栏
D
顶部