tags:

views:

264

answers:

2

Hi,

I am using VB.NET

My problem is that, I have got below request.querystring

http://localhost/ISS/Training/TrainingUpdate.aspx?cpuserid='50'&%20courseid='6'&%20status='accept'

Now I want to pass all the above three querystring in a sql stored procedure parameter.

for example,

Try
                Dim conString As String = WebConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString
                Dim con As New SqlConnection(conString)
                con.Open()
                Dim cmd As SqlCommand
                cmd = New SqlCommand("uspUpdateDelegateAcceptDeclineStatus", con)
                cmd.CommandType = CommandType.StoredProcedure
                cmd.Parameters.Add("@CPUserID", SqlDbType.Int).Value = Request.QueryString("cpuserid")
                cmd.Parameters.Add("@CourseID", SqlDbType.Int).Value = Request.QueryString("courseid")
                cmd.Parameters.Add("@StatusName", SqlDbType.Int).Value = Request.QueryString("status")
                cmd.ExecuteNonQuery()
            Catch ex As Exception
                ErrorHandler.WriteError(ex.Message)
            End Try

But I am able to get the request querystring value in my parameter.

Please suggest.

Thanks.

Best Regards, Yuv

A: 

Get rid of the extra '%20' (spaces) in the query string (if you can). If that's not an option, then remember that they are part of the query string, and so you'll need to include that when you access the values:

Request.QueryString(" cpuserid")
Joel Coehoorn
A: 

For one, it looks like you have some extra spaces in your URL (specifically in the QueryString...marked by %20).

Not sure if that would throw things off or not, but it's a possibility.

Justin Niessner