Haribalos
July 12th, 2002, 06:51 AM
I have an application which uses an mdb file , and im trying to figure out how to install this in ODBC thru the installer
The installer is InstallAnywhere 4.5.2.
I think that i need a C++ program to make ena api call to ODBC API is that right?
And if so , is there any example?
Thanks~!!
dinesh123
July 15th, 2002, 11:17 PM
I haven't use InstallAnywhere But I think from that u can run a other exe.
Following code is from vb to create a dsn.
ByVal sDriver As String, _
ByVal sDBFile As String, _
ByVal eAction As ACTION _
)
Dim sAttributes As String
Dim sDBQ As String
Dim sRegValue As String
Dim lRetVal As Long
Dim hKey As Long
Dim lValueType As Long
Dim sMessage As String
If RegOpenKeyEx(HKEY_CURRENT_USER, _
"Software\ODBC\ODBC.INI\" & sDSN, _
0, _
KEY_ALL_ACCESS, hKey _
) = 0 Then
sRegValue = String(1024, 0)
If RegQueryValueEx(hKey, _
"DBQ", _
0, _
lValueType, _
sRegValue, _
Len(sRegValue) _
) = 0 Then
If lValueType = REG_SZ Then
sDBQ = Left(sRegValue, InStr(sRegValue, vbNullChar) - 1)
End If
End If
RegCloseKey hKey
End If
If (sDBQ = "" And (eAction = ODBC_ADD_DSN Or eAction = ODBC_ADD_SYS_DSN)) _
Or _
(sDBQ <> "" And (eAction = ODBC_REMOVE_DSN Or eAction = ODBC_CONFIGURE_DSN)) Then
If Len(Dir(sDBFile)) = 0 Then
MsgBox "Database file doesn't exist!", vbOKOnly + vbCritical, "Cannot Continue"
Else
sAttributes = "DSN=" & sDSN & vbNullChar & "DBQ=" & sDBFile & vbNullChar
lRetVal = SQLConfigDataSource(0&, eAction, sDriver, sAttributes)
MsgBox "Done!"
End If
Else
If eAction = ODBC_ADD_DSN Or _
eAction = ODBC_ADD_SYS_DSN Then
sMessage = " already exists!"
Else
sMessage = " doesn't exist!"
End If
MsgBox "DSN: " & txtDsnName.Text & sMessage
End If
End Sub
Haribalos
July 16th, 2002, 05:03 AM
Thank you for your reply!!!
I did found an installer that installs Dsn , called WiseInstaller
i ll work both!