Datasource ?

Posted on 2006-04-23
Last Modified: 2010-08-05
I have a Datasource that's bound to an SQL Server stored procedure. This sp needs to be passed a paramater. How would I have the DS pass it the paramater?
Question by:szx248
    LVL 96

    Accepted Solution

    Here is a sample:

      Dim conn As New SqlConnection(connectionString)
      Dim cmd As New SqlCommand("sp_getlist", conn)
      cmd.CommandType = CommandType.StoredProcedure
      cmd.Parameters.Add("ID", SqlDbType.Int).Value = id
      Dim reader As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)


    Author Comment

    >Dim conn As New SqlConnection(connectionString)

    what is the connectionString? I am getting an error on this which I guess means that I have to set it. But how?

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now