Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input string was not in a correct format

Status
Not open for further replies.

JDAEMS

Programmer
Aug 27, 2003
84
BE
Dear Sir/Madam,

I have a web application, which worked perfectly on our QA environment. But I moved the application without changing anything to the code to our live server and suddenly I get the following error on my beginning page:

---------
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
----------

The only difference between those servers is that on the live server is service pack 4 of win2000 installed and on the other isn't.

The thing I'm trying to do in the code, where it fails according to me, is

--------------
Sub Load_Repeater()
'Connect to the database
oAS400Conn.Open()
'Make the select statement to get the groups
Dim sSelectSQL As String
sSelectSQL = "select FRGRPC, FRNAME, FRMODF, FRTYPE from COGDTA.SKUFRANP where FRBRND = 'EL' order by FRNAME"

Dim cmdSelect As New OdbcCommand(sSelectSQL, oAS400Conn)
Dim daGroup As New OdbcDataAdapter(cmdSelect)
Dim dsGroup As New DataSet

daGroup.Fill(dsGroup, "Groups")

Groups.DataSource = dsGroup.Tables("Groups").DefaultView
Groups.DataBind()

oAS400Conn.Close()
End Sub
----------------

And in the HTML:

---------------
...
<%# Container.DataItem("FRGRPC") %>
...
---------------

The FRGRPC is a numeric.

Has anyone had this problem before. The strange thing is that I'm not having it on QA and sometimes in the live environment it works as well. It seems to pop up this message randomly.

Thank you for your help.
Jelle
 
Looks like a dataissue are you sure that FRGRPC only returns numeric values with no null values?

What else is around <%# Container.DataItem("FRGRPC") %>. That error is usually cause when trying to change a string to a date, int, double and the input string doesn't look like it should. Null values could also cause problems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top