创建一完整数据源如下所示,用Install Shield5.0开发
szKey = "SOFTWARE//ODBC//ODBCINST.INI//ODBC Drivers";
szClass = "";
if (RegDBKeyExist ( szKey ) < 0) then
if (RegDBCreateKeyEx ( szKey , szClass ) < 0) then
MessageBox("驱动器创建失败", WARNING);
return 0;
endif;
endif;
if (RegDBSetKeyValueEx ( szKey , "MySQLAnyWhere" , REGDB_STRING , "Installed" , -1 ) < 0) then
MessageBox("驱动器创建失败", WARNING);
return 0;
endif;
szKey = "SoftWare//ODBC//ODBCINST.INI//MySQLAnyWhere";
// RegDBSetDefaultRoot ( nRootKey );
if (RegDBKeyExist ( szKey ) < 0) then
if (RegDBCreateKeyEx ( szKey , szClass ) < 0) then
MessageBox("驱动器创建失败", WARNING);
return 0;
endif;
endif;
RegDBSetKeyValueEx ( szKey , "Setup" , REGDB_STRING , WINSYSDIR ^ "//WOD50T.DLL" , -1 );
RegDBSetKeyValueEx ( szKey , "Driver" , REGDB_STRING , WINSYSDIR ^ "//WOD50T.DLL" , -1 );
nRootKey = HKEY_CURRENT_USER;
szKey = "SoftWare//ODBC//ODBC.INI//powerm";
szClass = "";
RegDBSetDefaultRoot ( nRootKey );
if (RegDBKeyExist ( szKey ) < 0 ) then
RegDBCreateKeyEx ( szKey , szClass );
endif;
RegDBSetKeyValueEx ( szKey , "AutoStop" , REGDB_STRING , "yes" , -1 );
RegDBSetKeyValueEx ( szKey , "DataBaseName" , REGDB_STRING , "Powerm" , -1 );
RegDBSetKeyValueEx ( szKey , "Driver" , REGDB_STRING , WINSYSDIR ^ "//WOD50T.DLL" , -1 );
RegDBSetKeyValueEx ( szKey , "PWD" , REGDB_STRING , "sql" , -1 );
RegDBSetKeyValueEx ( szKey , "UID" , REGDB_STRING , "dba" , -1 );
RegDBSetKeyValueEx ( szKey , "start" , REGDB_STRING , "dbeng50" , -1 );
szKey = "SoftWare//ODBC//ODBC.INI//ODBC Data Sources";
szClass = "";
if (RegDBKeyExist ( szKey ) < 0 ) then
RegDBCreateKeyEx ( szKey , szClass );
endif;
RegDBSetKeyValueEx ( szKey , "powerm" , REGDB_STRING , "MySQLAnyWhere" , -1 );