note 92453 deleted from class.com by cmb

From: Date: Tue, 05 Nov 2019 09:18:26 +0000
Subject: note 92453 deleted from class.com by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212896@lists.php.net to get a copy of this message
Note Submitter: rupams2002 at yahoo dot com ---- If you make a DLL in VB6 and want to access from PHP, here is the example. Only connection method is defined. You need to create rest.... How to use in PHP DLL refers ProjectName . ClassName $Obj = new COM ('ProjectName.ClassName'); $dw->MsSql_Connect('MachineName', 'DB_NAme'); If you want to connect Database through DLL then Open project in VB6 Class Module : And add this code and compile and make DLL. Public Function MsSql_Connect(ByVal DBMachineID As String, ByVal DBName As String) As Boolean Dim LocalCn As New ADODB.Connection Dim conStr As String, DB_UserID As String, DB_Password As String On Error GoTo ErrorHandler DB_UserID = "DBUserName" DB_Password = "DBPassword" Set LocalCn = New ADODB.Connection LocalCn.CursorLocation = adUseClient conStr = "Provider=SQLOLEDB.1;Password=" & DB_Password & ";Persist Security Info=True;User ID=" & DB_UserID & ";Initial Catalog=" & DBName & ";Data Source=" & DBMachineID & ";" LocalCn.Open conStr DBConnection = conStr MsSql_Connect = True Set LocalCn = Nothing ErrorHandler: If Err.Number <> 0 Then MsSql_Connect = False Set LocalCn = Nothing Err.Raise vbObjectError + 513, App.EXEName, Err.Description End If End Function "DBConnection" is a variable you need to Set + Get property in VB6 to keep the connection string alive in DLL. Remember : Err.Raise vbObjectError + 513, App.EXEName, Err.Description will raise error in PHP, user can see error in browser and stop execution php code. If you need any help email me. Mohammed Ziaul Hasan [Rupam] rupams2002@yahoo.com Senior Developer Canada

« previous php.notes (#212896) next »