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

M

Machelle Chandler

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top