I got my installation package for v.9.0 today. I tried it first to connect to am SQL Server database via ADO 2.8. Here is my code:
The code compiles and runs, but no matter which server I tried to connect using what provider I always got 'data source name too long' error (you can see that in ado28.inc in METHOD ConnectComplete as ACODE$(pError.Description). I can connect with the same connection string from VB6.
I found this Microsoft article http://support.microsoft.com/kb/134723
This is for the ADO Data Control and per the article the error is caused by a bug in the control that is it is changing semicolon to comma in the connection string. Is PB doing something similar? I am sending semicolons.
Any idea what am I missing here?
Thanks,
Peter Redei
Code:
#COMPILE EXE #DIM ALL #INCLUDE "win32api.inc" #INCLUDE "ADO28.inc" '<--- you can create it yourself FUNCTION PBMAIN () AS LONG FUNCTION PBMAIN () AS LONG LOCAL oConn AS Int__Connection LOCAL oComm AS Int__Command LOCAL oRecordset AS Int__Recordset LOCAL oRecord AS Int__Record LOCAL oError AS Int_Error LOCAL oConnEvents AS ConnectionEvents LOCAL sConnString AS STRING oConn = NEWCOM $PROGID_ADODB_Connection IF ISFALSE ISOBJECT(oConn) THEN MSGBOX "Unable to initialize ADO" EXIT FUNCTION END IF oConnEvents = CLASS "Class_ConnectionEvents" EVENTS FROM oConn CALL oConnEvents sConnString = "" '<----- try with yours MSGBOX "Connecting " & sConnString CALL oConn.Open(sConnString) IF oConn.Errors.Count = 0 THEN IF oConn.State = %adStateOpen THEN MSGBOX "Connected" END IF CALL oConn.Close MSGBOX "Disconnected" ELSE MSGBOX "Failed" END IF EXIT FUNCTION END FUNCTION
I found this Microsoft article http://support.microsoft.com/kb/134723
This is for the ADO Data Control and per the article the error is caused by a bug in the control that is it is changing semicolon to comma in the connection string. Is PB doing something similar? I am sending semicolons.
Any idea what am I missing here?
Thanks,
Peter Redei
Comment