function SetupRegistry()
NUMBER nResult;
STRING szPath, szKeyName;
begin
RegDBSetDefaultRoot ( HKEY_CURRENT_USER );
szKeyName = "Software//ODBC//ODBC.INI//我的数据库";
if(RegDBKeyExist(szKeyName)<0) then
RegDBCreateKeyEx (szKeyName,"");
else
RegDBDeleteKey (szKeyName);
RegDBCreateKeyEx (szKeyName,"");
endif;
szKeyName = "Software//ODBC//ODBC.INI//ODBC Data Sources";
if(RegDBKeyExist(szKeyName)<0) then
RegDBCreateKeyEx (szKeyName,"");
endif;
RegDBSetKeyValueEx ( szKeyName, "我的数据库" , REGDB_STRING ,"Microsoft Access Driver (*.mdb)" , -1);
szPath = TARGETDIR^"student.mdb";
szKeyName = "Software//ODBC//ODBC.INI//我的数据库";
RegDBSetKeyValueEx ( szKeyName, "DBQ" , REGDB_STRING , szPath , -1);
RegDBSetKeyValueEx ( szKeyName, "Description" , REGDB_STRING , "用于VC++的数据源" , -1);
RegDBSetKeyValueEx ( szKeyName, "Driver" , REGDB_STRING , WINSYSDIR+"/odbcjt32.DLL" , -1);
RegDBSetKeyValueEx ( szKeyName, "DriverID" , REGDB_NUMBER , "25" , -1);
RegDBSetKeyValueEx ( szKeyName, "SafeTransactions" , REGDB_NUMBER ,"0" , -1);
RegDBSetKeyValueEx ( szKeyName, "UID" , REGDB_STRING ,"" , -1);
RegDBCreateKeyEx ("Software//ODBC//ODBC.INI//我的数据库//Engines","");
RegDBCreateKeyEx ("Software//ODBC//ODBC.INI//我的数据库//Engines//Jet","");
szKeyName = "Software//ODBC//ODBC.INI//我的数据库//Engines//Jet";
RegDBSetKeyValueEx ( szKeyName, "Driver" , REGDB_STRING , WINSYSDIR+"/odbcjt32.DLL" , -1);
RegDBSetKeyValueEx ( szKeyName, "ImplicitCommitSync" , REGDB_STRING , "" , -1);
RegDBSetKeyValueEx ( szKeyName, "Threads" , REGDB_NUMBER , "3" , -1);
RegDBSetKeyValueEx ( szKeyName, "UserCommitSync" , REGDB_STRING , "Yes" , -1);
end;