Passing a parameter to Visual FoxPro Stored Procedure thru Visual Basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AJIT PITALE
    New Member
    • Mar 2007
    • 1

    Passing a parameter to Visual FoxPro Stored Procedure thru Visual Basic

    Hi,

    I am using Visual Basic 6 as front end and Visual FoxPro as a Database.
    I am trying to pass a parameter from VB to Visual FoxPro's Stored Procedure.

    I am getting an error showing "Data type mismatch"

    My Connection String is :CNN.ConnectionS tring = "Provider=VFPOL EDB.1;Data Source=P:\pay.d bc;Mode=ReadWri te|Share Deny Write"

    CNN.Open


    My VB code is :
    Private Sub cmdPack_Click()
    Dim zCmd As ADODB.Command
    Dim zPar As ADODB.Parameter
    Dim zVariable As String
    zVariable = "Ajit"

    Set zCmd = New ADODB.Command
    With zCmd
    .ActiveConnecti on = CNN
    .CommandType = adCmdStoredProc
    .CommandText = "chkpara"
    Set zPar = .CreateParamete r("pPara", adChar, adParamInput, 4, zVariable)
    .Parameters.App end zPar
    .Execute
    End With
    End Sub


    My Stored Procedure (in the database) is :
    *---------------------------------
    PROCEDURE chkPara
    *--------------------------------
    parameter pPara
    insert into salary_structur e_detail value('0001','0 001','11014I5', pPara,9000)
    ENDPROC


    When I execute the VB program by clicking on the cmdPack Command Button
    it shows the error "Data type mismatch"


    please help

    regards

    Ajit Pitale
Working...