http://msdn.microsoft.com/library/defau ... figdsn.aspConfigDSN receives connection information from the installer DLL as a list of attributes in the form of keyword-value pairs. Each pair is terminated with a null byte, and the entire list is terminated with a null byte. (That is, two null bytes mark the end of the list.) Spaces are not allowed around the equal sign in the keyword-value pair.
You should call the procedures like this :
Code: Select all
crlf.s=Chr(13)+Chr(10)
DRIVER$="Microsoft Access Driver (*.mdb)"
ATTRIB$="DSN="+DSNName$+";";+crlf
ATTRIB$+"DBQ="+DBFile$+";";+crlf
ATTRIB$+"UID=Admin;";+crlf
ATTRIB$+"PWD="+PWD$+";";+crlf
ATTRIB$+"SafeTransactions=1;";+crlf
ATTRIB$+"ExtendedAnsiSQL=1;"
ATTRIB$+";" ; <- the second null byte !
MakeConnection(DRIVER$,ATTRIB$)
Code: Select all
ProcedureDLL DeleteConnection(Driver.s,DSN.s) ;Delete a DSN Connection
strAttributes.s = "DSN="+DSN+";;"
If Driver.s=""
Driver.s=DefaultDriver.s
EndIf
MyMemory=AllocateMemory(Len(strAttributes))
CopyMemory(@strAttributes,MyMemory,Len(strAttributes))
For L=1 To Len(strAttributes)
If PeekB(MyMemory +L-1)=Asc(";")
PokeB(MyMemory +L-1,0)
EndIf
Next
Result=SQLConfigDataSource_(0,#ODBC_REMOVE_DSN,Driver.s,MyMemory )
FreeMemory(MyMemory)
ProcedureReturn Result
EndProcedure