codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Input string was not in a correct format  wjer at 17:42 on Monday, December 15, 2003
 

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

  Re: Input string was not in a correct format  sili18 at 04:54 on Wednesday, February 25, 2004
 

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....









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Date script issues
•  perl script help needed
•  onChange issue
•  perl remote execution
•  Chat application
•  How to send multiple perameters in SOAP request.
•  Java code for Insert picture on the table in spreadsheet
•  Re: Problem with concatenation
•  how to genrates the crystal report by sending a id at runtime


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007