Results 1 to 9 of 9

Thread: Passing Parameters in Stored Procedures

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279

    Question

    I'm trying to pass 3 parameters to a stored procedure but can't figure out how to do it. Here's the gist of the parameters I need to pass. Bear in mind I'm not sure about the syntax.

    FillList.CommandText = "prGetOutCustRMA
    (lstCompany.list(lstcompany.listindex) ,txtCustDate1.text,txtCustDate2.text)"

    I need to pass the values in the list box, and two text boxes. I continue to get errors. Any hints?
    A cynic knows the price of everything but the value of nothing.

  2. #2
    New Member
    Join Date
    Mar 2001
    Location
    NY, NY
    Posts
    6
    I hope this helps........
    -----------------------------------------------------------------
    Dim fillList as ADODB.Command
    Dim prGetOutCustRMA as ADODB.Parameter
    Dim strCompany as string

    Set fillList.ActiveConnection = (your connection object)
    fillList.CommandText = "storedprocedurename"
    fillList.CommandType = adCmdStoredProc

    strCompany = lstCompany.list(lstcompany.listindex)

    Set prGetOutCustRMA = fillList.CreateParameter(Company, adWChar, adParamInput, ,strCompany)
    fillList.Parameters.Append prGetOutCustRMA

    Set prGetOutCustRMA = fillList.CreateParameter(CustDate1, adDBDate, adParamInput, ,cDate(txtCustDate1.text))
    fillList.Parameters.Append prGetOutCustRMA

    Set prGetOutCustRMA = fillList.CreateParameter(CustDate2, adDBDate, adParamInput, ,cDate(txtCustDate2.text))
    fillList.Parameters.Append prGetOutCustRMA

    fillList.Execute

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279
    Thanks so much! That was a great help!
    A cynic knows the price of everything but the value of nothing.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279
    However...

    When running this:

    FillList.CommandText = "prGetOutCustRMA"
    strCompany = lstCompany.List(lstCompany.ListIndex)
    Set prGetOutRMA = FillList.CreateParameter("Company", adVarWChar, adParamInput, 15, _
    strCompany)
    FillList.Parameters.Append prGetOutRMA

    Set prGetOutRMA = FillList.CreateParameter("Date1", adDBDate, adParamInput, , _
    CDate(txtCustDate1.Text))
    FillList.Parameters.Append prGetOutRMA

    Set prGetOutRMA = FillList.CreateParameter("Date2", adDBDate, adParamInput, , _
    CDate(txtCustDate2.Text))
    FillList.Parameters.Append prGetOutRMA

    Set grsReportList = FillList.Execute

    I get this error:
    "[ODBC SQL Server driver]Optional feature not implemented."

    Any clues?
    A cynic knows the price of everything but the value of nothing.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279
    The answer to the ODBC driver error was that SQL Server doesn't accept the adDBdate data type. I changed it to adDBTimeStamp and it worked fine.
    A cynic knows the price of everything but the value of nothing.

  6. #6
    New Member
    Join Date
    Mar 2001
    Location
    NY, NY
    Posts
    6
    hey glad to hear it! now, when you get your app up and running and you've successfully packaged it and tested the install on a remote machine, please write back and let me know how you handled the ODBC connectivity. I've been having problems all week packaging my app so that the DSN for my app's ODBC connection is set up automatically.

    So far, installation is successful, but I still have to manually set up the ODBC data source through the control panel before my app sees the database. I hope you have better luck with this than I've been having...

    thanks...
    Sabrina

  7. #7
    Hyperactive Member
    Join Date
    Feb 2000
    Posts
    284
    You should use an INI file on the client machine that your app reads on startup and registers the appropriate database automatically. In DAO there is a function for this DBEngine.RegisterDatabase but with ADO you have to use an API call.....
    Hope this helps

  8. #8
    Junior Member
    Join Date
    Oct 2000
    Location
    High Wycombe, UK
    Posts
    25
    Hi VBWizInTraining,

    Why not use a DSNLess connection ?
    Ciao.........Gary

    VB6, SQL Server 7, Access 97

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279

    Question

    Is there a way to programmically create an ODBC DSN? In other words, what is the actual API?
    A cynic knows the price of everything but the value of nothing.

Posting Permissions

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



Click Here to Expand Forum to Full Width