|
I have no idea what the problem is here - especially because this code seemingly worked a few hours ago (though maybe I changed something small).
I'm trying to read from the querystring an integer value. Based on the querystring's content, I do a lookup in the database and present a different page to the user. For instance, http://localhost/wjer03/content.aspx?page=1 uses a Stored Proc to Select the record where the contentID is '1'. However, I keep getting 'Input string was not in a correct format'. Here's my code - any ideas?
Public Sub DisplayContent()
Dim qsPage As String = Request.QueryString("page")
Dim cn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnString"))
Dim cmdContent As SqlCommand = New SqlCommand("ViewContent", cn)
cmdContent.CommandType = CommandType.StoredProcedure
cmdContent.Parameters.Add("@pageRequested", SqlDbType.Int).Value() = qsPage
cn.Open()
Dim rdrContent As SqlDataReader
listContent.DataSource = cmdContent.ExecuteReader()
listContent.DataBind()
cn.Close()
End Sub
|
|
|
Hi
Try like this...
cmdContent.CommandType = CommandType.StoredProcedure
Here create your parameter object
dim myParam as sqlParameter
myParam=
cmdContent.Parameters.Add("@pageRequested", SqlDbType.Int)
myParam.Value=qsPage
Now it will work fine....
If u still get problem...
Write again...
Siva....
|
|
|
|
|
|
|
// |