//----------注册ODBC---------
function SetupRegistry()
STRING svDB,svText,svMsg,ODBCName,DriverName,DriverPath,szKey, szItemName, szItemValue, svItemValue, szTitle, szMsg;
NUMBER nType, nSize, nvType, nvSize,nvFileHandle;
begin
nType=REGDB_STRING;
svMsg="正在更新注册表......";
SdShowMsg(svMsg,TRUE);
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
//GET THE DRIVER OF Microsoft ODBC for ORACLE
ODBCName="ems3" ;
DriverName="Microsoft ODBC for Oracle";
svDB="SOFTWARE//ODBC//ODBCINST.INI//"+DriverName;
if (RegDBKeyExist(svDB)<0) then
MessageBox("本机器中未安装Oracle,请查实!", SEVERE);
else
if (RegDBGetKeyValueEx (svDB, "Driver", nvType, svItemValue,nvSize) < 0) then
MessageBox ("RegDBGetKeyValueEx failed..", SEVERE);
else
MessageBox(svItemValue,INFORMATION);
DriverPath=svItemValue;
endif;
endif;
svDB="SOFTWARE//ODBC//ODBC.INI//"+ODBCName;
if (RegDBKeyExist(svDB)<0) then
RegDBSetKeyValueEx ( svDB , "BufferSize" , REGDB_STRING , "65535" , -1 );
RegDBSetKeyValueEx ( svDB , "Description" , REGDB_STRING , "" , -1 );
RegDBSetKeyValueEx ( svDB , "Driver" , REGDB_STRING , DriverPath , -1 );
RegDBSetKeyValueEx ( svDB , "DSN" , REGDB_STRING , ODBCName , -1 );
RegDBSetKeyValueEx ( svDB , "GuessTheColDef" , REGDB_STRING , "0" , -1 );
RegDBSetKeyValueEx ( svDB , "PWD" , REGDB_STRING , "" , -1 );
RegDBSetKeyValueEx ( svDB , "Remarks" , REGDB_STRING , "0" , -1 );
RegDBSetKeyValueEx ( svDB , "SERVER" , REGDB_STRING , "tina" , -1 );
RegDBSetKeyValueEx ( svDB , "StdDayOfWeek" , REGDB_STRING , "1" , -1 );
RegDBSetKeyValueEx ( svDB , "StripTrailingZero" , REGDB_STRING , "0" , -1 );
RegDBSetKeyValueEx ( svDB , "SynonymColumns" , REGDB_STRING , "1" , -1 );
RegDBSetKeyValueEx ( svDB , "UID" , REGDB_STRING , "cop_ems3" , -1 );
RegDBSetKeyValueEx ( "SOFTWARE//ODBC//ODBC.INI//ODBC Data Sources" , ODBCName , REGDB_STRING , DriverName , -1 );
else
MessageBox("本机器ODBC中已存在"+ODBCName+",请查实!", INFORMATION);
endif;
SdShowMsg(svMsg,FALSE);
end;