> c) we are using the Install Builder, how exactly can we make our
> installer to create the .dsn?
>
Jim Kane:
This code I wrote for someone else on the newsgroup makes a dsn and deletes it. You need to make lib files for the indicated dlls.
program _abcdllmode_ equate(0) _abclinkmode_ equate(1) map module('api') sqlinstallererror(ushort ierror, *ulong pfErrorCode,| *cstring szErrorMsg, ushort cbErrorMsgMax,| *ushort pcbErrorMsg),short,pascal,raw,Name('SQLInstallerError') !found in odbccp32.dll configdsn(unsigned,ushort,*cstring,*cstring)| ,bool,raw,pascal,Name('ConfigDsn') !found in odbcjt32.dll end end driverstring cstring(256) attrstring cstring(256) !attribute string to pass in configdsn maindir cstring('c:\maindir\') !junk non-existant dir to produce an error rv bool !return value from configdsn 0=error i ushort !sqlinstallererror can return up to 8 error codes szErrorstr cstring(256) !receives an error string fErrorCode ulong !receives and errorcode cbErrorMsg ushort !size of errorstr returned !sql related equates for return value from SQLInstallerError SQL_Success equate(0) Sql_Success_with_Info equate(1) SQL_STILL_EXECUTING equate(2) SQL_Error equate(-1) SQL_No_Data equate(100) eRet short code if message('Create DSN or Error','CreateDSN Demo',icon:question,'DSN|Error')=1 driverstring='Access'&'<0><0>' else driverstring='<0><0>' end attrstring='DSN=temp;DriverID=25;DBQ=' & clip(maindir) & '\dacsdata.mdb'& '<0><0>' rv=ConfigDSN(0,1,driverstring,attrstring) !create the DSN if ~rv then Message('Config DSN Failed - error messages to follow.') loop I=1 to 8 eRet=SqlInstallerError(I,fErrorcode, szErrorStr, size(szErrorStr)-1, cbErrorMsg) if (eRet=Sql_Success or eRet=Sql_Success_With_Info) and cbErrormsg then message(szErrorstr,'ConfigDSN Error') else message('End of Error Messages') break end end else message('If you open ODBC in control panel before pressing ok, you''ll see your dsn','configdsn worked') rv=configDsn(0,3,driverstring,attrstring) if rv then message('the dsn was deleted') else Message('deleting the dsn failed') end end return