如何自动配置odbc

najzni 2004-06-13 02:11:26
用odbc开发的数据库程序,在移植程序到其他机子上的时候如何自动配置odbc,而不用手动去配置odbc?
...全文
150 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhaolaoxin 2004-06-13
  • 打赏
  • 举报
回复
可以生成一个文件dsn,然后拷到目标机的相应目录下即可。
najzni 2004-06-13
  • 打赏
  • 举报
回复
楼主:
如果是DB2数据库,
那么lpszAttributes 应该是怎样的?
Kudeet 2004-06-13
  • 打赏
  • 举报
回复
http://dev.csdn.net/develop/article/27/27338.shtm

应该可以了
bluebohe 2004-06-13
  • 打赏
  • 举报
回复
SQLConfigDataSource
Conformance

Version Introduced: ODBC 1.0

Summary

SQLConfigDataSource adds, modifies, or deletes data sources.

Syntax

BOOL SQLConfigDataSource(
HWND hwndParent,
WORD fRequest,
LPCSTR lpszDriver,
LPCSTR lpszAttributes);
Arguments

hwndParent
[Input]
Parent window handle. The function will not display any dialog boxes if the handle is null.
fRequest
[Input]
Type of request. The fRequest argument must contain one of the following values:
ODBC_ADD_DSN: Add a new user data source.

ODBC_CONFIG_DSN: Configure (modify) an existing user data source.

ODBC_REMOVE_DSN: Remove an existing user data source.

ODBC_ADD_SYS_DSN: Add a new system data source.

ODBC_CONFIG_SYS_DSN: Modify an existing system data source.

ODBC_REMOVE_SYS_DSN: Remove an existing system data source.

ODBC_REMOVE_DEFAULT_DSN: Remove the default data source specification section from the system information. (It also removes the default driver specification section from the Odbcinst.ini entry in the system information. This fRequest performs the same function as the deprecated SQLRemoveDefaultDataSource function.) When this option is specified, all of the other parameters in the call to SQLConfigDataSource should be NULLs; if they are not NULL, they will be ignored.

lpszDriver
[Input]
Driver description (usually the name of the associated DBMS) presented to users instead of the physical driver name.
lpszAttributes
[Input]
List of attributes in the form of keyword-value pairs. For more information, see ConfigDSN in Chapter 22: Setup DLL Function Reference.

4,012

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧