在InstallShield中引入ODBC对象时如何去掉不需要的动态链接库(100分)

  • 主题发起人 主题发起人 woodmud
  • 开始时间 开始时间
W

woodmud

Unregistered / Unconfirmed
GUEST, unregistred user!
  小弟用Delphi做了一个数据库程序,是用ODBC链接到Access数据库的,在用InstallShield做安装程序发布时,引入ODBC对象进行配置,本来的安装程序只有2M,现在一下达到了9M,原因是ODBC对象加入了很多动态链接库,而实际上这些动态链接库在Windows操作系统的机子都有的,问怎么样去掉这些动态链接库,而只保留DataSource设置。
 
其实ODBC配置是写在注册表中的,如果你认为安装盘运行的机器都带有ODBC,那可以用以下方法,
请参考,
Creating DSN is very easy in Installed shield. I am creating DSN in my setup.
Steps how to create DSN.
1. For your knowledge purpose, First create a sample DSN using ODBC.
2. Now click run and enter Regedit through Start Menu of the system.
3. and go to the HKEY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBC.INI/
you will be seeing all DSN names with their respective folders (Ex: My DSN name is DefectTracker ).
4.If you click on your sample DSN Name folder (ExefectTracker), you will be seeing Name,type and Data on right side of the screen.
Under Name -- Data
Database -- DefectTracker
Driver -- C:/WINNT/System32/sqlsrv32.dll
LastUser -- sa
5. and go to the path HKEY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBC.INI/ODBC Data Sources. Here in right side of the screen,u can see your sample database name.
6. Now, what u have todo
is....
7.create the same path in installedshield at Resource tab under Registry Set.
8. And generally Server name will be different, so u need to write the syntax to create Server name in the specified folder in Registry.By using
szKey = "SOFTWARE//ODBC//ODBC.INI//DefectTracker";
szServerSet = "SERVER";
nType = REGDB_STRING;
nSize = -1;
if (RegDBSetKeyValueEx (szKey, szServerSet, nType,szServer,nSize) < 0) then
MessageBox ("Not able to Create DSN for DefectTracker.", SEVERE);
endif;
u need to pass the Server servername in to szserver variable.
Your DSN will be created.
If anydo
ubts pls feel free to ask again...
Thanks
 
用的是ADO还是BDE??
前者的话,连ODBC都不要用了,直接都可以用的,何必打包太多,参看一下这个例子吧
在程序中动态连接Access数据库的例子,不用设置ODBC。
http://www.aidelphi.com/6to23/docu/ADODemo.zip
 

Similar threads

D
回复
0
查看
767
DelphiTeacher的专栏
D
D
回复
0
查看
809
DelphiTeacher的专栏
D
D
回复
0
查看
639
DelphiTeacher的专栏
D
后退
顶部