注册 登录
编程论坛 汇编论坛

使用win32汇编和odbc能不能建立一个空的mdb文件

swp160108 发布于 2009-08-28 13:23, 1352 次点击
搜索很多网页没找到, 找到的也不对.
9 回复
#2
nzxhust2009-08-28 15:52
后缀是mdb就可以了吗?
用通用对话框的保存‘对话框’保存文件时候直接输入名字.mdb就可以创建个mdb了不知道可以吗?
#3
nzxhust2009-08-28 15:55
直接用CreateFile不能打开一个.mdb的?
#4
东海一鱼2009-08-28 18:45
BOOL SQLConfigDataSource(HWND hwndParent, UINT
fRequest,LPCSTR IpszDriver, LPCSTR IpszAttributes);
其中四个参数的用法如下:
1参数hwndPwent是父级窗口句柄。如果句柄
为NULL,将不会显示一些有关的对话框。
如果参数 IpszAttributes提供的信息不够完善,
在创建过程中就会出现对话框要求用户提供相应信
息。
2参数fRequest可以设置为下面的数值之一:
ODBC_ADD_DSN: 增加_个新数据源
ODBC_CONHG_DSN: 配置(修改)一个已经存在的数据源
ODBC_REMOVE_DSN: 删除一个已经存在的数据源
ODBC_ADD_SYS_DSN:. 增加一个新的系统数据源
ODBC_CONFIG—SYS—DSN: 更改一个已经存在的系统数据源
ODBC_REMOVE_SYS_DSN:. 删除一个已经存在的系统数据源
3参数lpszDriver是数据库引擎名称,可以参见
ODBC管理器中对ODBC驱动程序的描述。比如要加
载的是Access数据库,那么数据库引擎名称就为"Microsoft Access Driver (*.mdb)"
4参数lpszAttributes为一连串的"KeyName=value"
字符串,每两个KeyName值之间用""字
符隔开。KeyName主要是新数据源缺省的驱动程序
注册说明,其中最主要的关键字是"DSN"-----    新
数据源的名称,其余关键字则根据不同的数据源有
不同要求。

[ 本帖最后由 东海一鱼 于 2009-8-28 18:48 编辑 ]
#5
swp1601082009-08-29 10:31
楼上那个是建立数据源
我要建立的是mdb文件, 就是用access建立的mdb文件, 不是用CreateFile建立出来的
#6
东海一鱼2009-08-29 11:39
我晕,你学得也太死了吧。
对文件型数据库来说,根据给出的关键字,建立数据源本身就是建立文件。
Creates a database file. Has the following format: CREATE_DB=<path_name><optional_sort-order><optional_ENCRYPT keyword>, where the path name is the full path to a Microsoft Access database. An error will be returned if the path name specifies an existing database. The sort order will be as set up in the New Database dialog box displayed when the Create button is pressed in the Microsoft Access Setup dialog box. If no sort order is specified, General is used.
When using the CREATE_DB keyword in the same statement with a DSN keyword, this driver ignores the DSN keyword. Therefore, creating a database and specifying a DSN is a two-step process.When using the CREATE_DB keyword, if the pathname of the Microsoft Access database to be created contains one or more spaces, then the entire pathname must be enclosed by double quotation marks, as shown in the following examples:

"C:\PROGRAM FILES\COMMON FILES\
MyAccess.mdb"

"C:\PROGRAM FILES\Access2.mdb"

CREATE_DB=C:\TEMP\test.mdb (no quotation marks needed)
#7
zklhp2009-08-30 20:37
貌似问这个的不少~~~~
偶不懂这个 学习下~~~
#8
swp1601082009-08-31 15:02

谢谢 试验成功 看不到英文呀 所以对帮助不理解
#9
swp1601082009-08-31 15:02

谢谢 试验成功 看不到英文呀 所以对帮助不理解
1