Using query string to pass a value to a stored procedure parameter

Discussion in 'ASP .Net Datagrid Control' started by Machelle Chandler, Oct 21, 2003.

  1. All,

    I want to push on a form button in an HTML page and pass a query string
    to the ASP.NET page I’m opening.

    That query string has the parameter value for my stored procedure so it
    knows what data to present in the resulting data grid. I’ve taken some
    of the code
    out from my asp page (e.g. connection string info) to make it shorter.

    Any advice would be greatly appreciated? I've never used query strings
    before and am having a hard time finding info on it on the web.

    Machelle

    HTML Page – code on a button which calls the ASP page:

    <form name="form1" method="get"
    action="http://localhost:638/development/FDO/dyn_uyp_curriculum.aspx?com
    petency_name="Business Acumen"">
    <input type="submit" name="Submit" value="Submit">
    </form>



    ASP.NET Page – uyp_querystring is the value I’m trying to collect from
    the above html page. I want to pass it as a parameter to my stored
    procedure.

    Dim uyp_querystring As
    System.Collections.Specialized.NameValueCollection
    uyp_querystring = Request.QueryString

    Me.conUYP = New System.Data.SqlClient.SqlConnection()
    Me.daUYP = New System.Data.SqlClient.SqlDataAdapter()
    Me.cmdUYP = New System.Data.SqlClient.SqlCommand()
    Me.DsUYP1 = New FDO.dsUYP()
    CType(Me.DsUYP1,
    System.ComponentModel.ISupportInitialize).BeginInit()
    '


    'cmdUYP
    '
    Me.daUYP.SelectCommand = Me.cmdUYP
    Me.cmdUYP.CommandText = "dbo.[prc_uyp_curriculum]"
    Me.cmdUYP.CommandType =
    System.Data.CommandType.StoredProcedure
    Me.cmdUYP.Connection = Me.conUYP
    Me.cmdUYP.Parameters.Add(New
    System.Data.SqlClient.SqlParameter("@web_competency_name",
    System.Data.SqlDbType.NVarChar, 50))
    Me.cmdUYP.Parameters("@web_competency_name").Value =
    uyp_querystring


    Machelle Chandler
    Intel Corporation
    Beginning .NET developer
    Thanks in advance for the help!

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Machelle Chandler, Oct 21, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven
    Replies:
    5
    Views:
    5,961
    Jeff Louie
    May 27, 2004
  2. Replies:
    2
    Views:
    4,431
  3. psycho
    Replies:
    2
    Views:
    3,885
    jan.skacel
    Nov 20, 2008
  4. Jack
    Replies:
    1
    Views:
    151
    Bob Barrows [MVP]
    Dec 28, 2004
  5. David Shorthouse
    Replies:
    1
    Views:
    250
    Bob Barrows [MVP]
    Mar 7, 2006
Loading...

Share This Page