Vb6.0 Dll

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandeepthachan
    New Member
    • Jan 2007
    • 17

    Vb6.0 Dll

    i have created a ActiveX dll using the below mentioned code...Ho can i call the same into a Visual basic 6.0 Application.. I have converted this to a DLL

    [code=vb]
    Public Function GetDet(ByVal str As String) As ADODB.Recordset
    On Error GoTo Err:
    CON.CursorLocat ion = adUseClient
    strCon = "Connection "
    CON.Open (strCon)
    If REC.State = 1 Then REC.Close
    REC.Open "select emp_name from employee_master where emp_id='" & str & "'", CON, adOpenForwardOn ly, adLockReadOnly
    If Not REC.EOF Then
    Set GetDet = REC
    REC.MoveNext
    Else
    MsgBox "No Employee Found"
    End If
    Err:
    End Function[/code]


    If anybody know the code to call the same to a VB6.0 Application program. KIndly let me know
    Last edited by debasisdas; Feb 13 '08, 01:44 PM. Reason: added code=vb tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    1. Copy the DLL into system32 folder.
    2. Register the dll using REGSVR32 key.
    3. Refer that dll through other VB Application from Project--->Reference.

    Comment

    • sandeepthachan
      New Member
      • Jan 2007
      • 17

      #3
      Originally posted by debasisdas
      1. Copy the DLL into system32 folder.
      2. Register the dll using REGSVR32 key.
      3. Refer that dll through other VB Application from Project--->Reference.
      I have created one object and assigned a parameter value to the same. But its showing an error message like 'Runtime Error:91' Object Variable or With Block Variable not Set. . Whats Could be the problem. Can u give me a simple code to fetch the data from the same to a textbox

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        I am not sure from your code ,what you are trying to do .

        Comment

        • sandeepthachan
          New Member
          • Jan 2007
          • 17

          #5
          Originally posted by debasisdas
          I am not sure from your code ,what you are trying to do .
          I want to display the employee_name in to a text Box,through passing Emp_no to the DLL function

          I have writtent the code in a Command button of a form as:

          Dim EMP as New Employee.ClassN ame
          TExt2.text=EMP. GetDet(Text1.Te xt)


          But here i am getting some error

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            If you want to display in a textbox why are you returning an entire recordset from the function.

            Your codes does not seem to do what you want.

            Comment

            • Killer42
              Recognized Expert Expert
              • Oct 2006
              • 8429

              #7
              Subscribing .

              Comment

              • sandeepthachan
                New Member
                • Jan 2007
                • 17

                #8
                Originally posted by debasisdas
                If you want to display in a textbox why are you returning an entire recordset from the function.

                Your codes does not seem to do what you want.
                Do you have any sample code to show the working of a dll. Then it would be a great help for me.

                Comment

                Working...