note 92453 added to class.com

From: Date: Fri, 24 Jul 2009 17:38:19 +0000
Subject: note 92453 added to class.com
Groups: php.notes 
Request: Send a blank email to php-notes+get-158703@lists.php.net to get a copy of this message
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 ---- Server IP: 72.55.140.6 Probable Submitter: 208.124.168.90 ---- Manual Page -- http://www.php.net/manual/en/class.com.php Edit -- https://master.php.net/note/edit/92453 Del: integrated -- https://master.php.net/note/delete/92453/integrated Del: useless -- https://master.php.net/note/delete/92453/useless Del: bad code -- https://master.php.net/note/delete/92453/bad+code Del: spam -- https://master.php.net/note/delete/92453/spam Del: non-english -- https://master.php.net/note/delete/92453/non-english Del: in docs -- https://master.php.net/note/delete/92453/in+docs Del: other reasons-- https://master.php.net/note/delete/92453 Reject -- https://master.php.net/note/reject/92453 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158703) next »