ExDatabase Library OpenSource

Developed or developing a new product in PureBasic? Tell the world about it.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

found a bug in the ExDatabase Library
ConfigDSN 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.
http://msdn.microsoft.com/library/defau ... figdsn.asp

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$)
but the DeleteConnection function has to be corrected like this :

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
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

Post by Kanati2 »

Can I use DSNLess connections? I won't use a database command-pack where I have to configure a DSN. It's a useless waste. Absolutely nothing I create in VB/C++/.NET uses DSNs, nor should it.
Kanati2
User
User
Posts: 27
Joined: Thu Jun 03, 2004 5:18 am
Contact:

Post by Kanati2 »

Guess it doesn't matter much... the download is broken.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Post by ABBKlaus »

Post Reply