CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Working with Visual Basic 60 with Oracle Stored Procedure

  1. #1
    Join Date
    Nov 2015

    Unhappy Working with Visual Basic 60 with Oracle Stored Procedure

    Hallo Guys,
    I have an old Visual Basic Application that i m trying to incorporate Oracle Database Procedures to increase speed and efficiency. However i have a problem with passing parameters from VB to the Procedure "I keep on receiving an error message of Wrong number or types of arguments". Below is the VB Code calling and passing parameters to Oracle Stored Procedure and the Declaration part of the Stored Procedure. Kindly help where i am going wrong.

    ---VB Code Here

    Dim Rs As New ADODB.Recordset
    Dim cmd As New ADODB.Command
    Dim param As New ADODB.Parameter
    Dim Str As String
    Dim Omwosi, Omwaka, Enyanga, Contp
    Dim res As Integer

    Enyanga = Day(Now)
    Omwosi = Month(Now)
    Omwaka = Year(Now)

    If Len(Enyanga) = 1 Then
    Enyanga = "0" & Enyanga
    End If

    If Len(Omwosi) = 1 Then
    Omwosi = "0" & Omwosi
    End If

    If Rs.State = 1 Then
    End If

    Contp = Omwosi & Omwaka
    v_USR_NM = Username
    V_ERRR_MSSG = ""
    v_Chqno = TxtChqNo.Text
    ChqAcNo = TxtAliase.Text
    Locator = TxtAcNo.Text
    Amount = TxtAmount.Text
    V_imageF = TxtFimg.Text
    v_imageB = TxtBimg.Text
    v_Locator = Locator
    v_Amnt_ip = Amount
    V_CRRNT_DTNO = Omwaka & Omwosi & Enyanga

    TranT = "CHEQCLR"
    Call Create_TransactionID

    With cmd
    .ActiveConnection = ConACExp
    .CommandText = "InHseClr_dp"
    .CommandType = adCmdStoredProc
    cmd.Parameters.Append cmd.CreateParameter("result", adInteger, adParamInputOutput, 0)
    cmd.Parameters.Append cmd.CreateParameter("ChqAcNo", adVarChar, adParamInput, 30, ChqAcNo)
    cmd.Parameters.Append cmd.CreateParameter("v_Locator", adVarChar, adParamInput, 30, v_Locator)
    cmd.Parameters.Append cmd.CreateParameter("Chqno", adVarChar, adParamInput, 30, v_Chqno)
    cmd.Parameters.Append cmd.CreateParameter("v_Amnt_ip", adVarChar, adParamInput, 30, v_Amnt_ip)
    cmd.Parameters.Append cmd.CreateParameter("v_USR_NM", adVarChar, adParamInput, 60, v_USR_NM)
    cmd.Parameters.Append cmd.CreateParameter("BcodeUser", adVarChar, adParamInput, 10, BcodeUser)
    cmd.Parameters.Append cmd.CreateParameter("CompName", adVarChar, adParamInput, 60, CompName)
    cmd.Parameters.Append cmd.CreateParameter("Absid", adVarChar, adParamInput, 60, Absid)
    cmd.Parameters.Append cmd.CreateParameter("Contp", adVarChar, adParamInput, 20, Contp)
    cmd.Parameters.Append cmd.CreateParameter("V_imageF", adVarChar, adParamInput, 200, V_imageF)
    cmd.Parameters.Append cmd.CreateParameter("v_imageB", adVarChar, adParamInput, 200, v_imageB)
    cmd.Parameters.Append cmd.CreateParameter("V_CRRNT_DTNO", adChar, adParamInput, 20, V_CRRNT_DTNO)
    Set Rs = cmd.Execute
    res = cmd("result")
    If (res = 1) Then
    MsgBox "Updated Successfully"
    MsgBox "Error Update unsuccessful.", vbInformation, "No update done"
    End If
    Set cmd.ActiveConnection = Nothing

    End With

    ---Procedure Declaration Part

    PROCEDURE InHseClr_dp
    ( result IN OUT NUMBER,
    ChqAcNo IN VARCHAR2,
    v_Locator IN VARCHAR2,
    v_ChqNO IN VARCHAR2,
    v_Amnt_ip IN out VARCHAR2,
    CompName IN VARCHAR2,
    Absid IN VARCHAR2,
    ContP IN VARCHAR2,
    V_imageF IN VARCHAR2,
    v_imageB IN VARCHAR2,
    ) IS
    -- variables
    Bcode varchar2(5);
    v_ACCNO varchar2(30);
    v_BCODE varchar2(5);

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: Working with Visual Basic 60 with Oracle Stored Procedure

    Your last parameter is of a different type than the others but is defined in the SP the same as the others
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)