473,498 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

input string not in correct format

I am gettign this error, while migration an app to asp.net

Exception Details: System.FormatException: Input string was not in a
correct format.

Source Error:

Line 19: Dim enddate = request.QueryString("enddate")
Line 20:
Line 21: if cint(eventid) = "0" then
Line 22: searchtype = 0
Line 23: else
Source File: C:\Documents and
Settings\amit\WebSite1\reports\loc_summary_calc.as px Line: 21

Stack Trace:

[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.Conversions .ParseDouble(String
Value, NumberFormatInfo NumberFormat) +216
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String
Value) +91[InvalidCastException: Conversion from string "ns" to type
'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String
Value) +247
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(Object
Value) +988
ASP.loc_summary_calc_aspx.__Render__control1(HtmlT extWriter __w,
Control parameterContainer) in C:\Documents and
Settings\amit\WebSite1\reports\loc_summary_calc.as px:21
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +278
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24The code
isdim eventid, subeventid, cyear, searchalleventeventid =
request.QueryString("VIOSel1")subeventid =
request.QueryString("subvioSel1")cyear =
request.QueryString("cyear")searchallevent =
request.QueryString("searchall")Dim startdate =
request.QueryString("startdate")Dim enddate =
request.QueryString("enddate")
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+8937

The code is as follows,
<%
dim searchtype
'0 - search all zone
'1 - search by zone
'2 - search by location

dim eventid, subeventid, cyear, searchallevent

eventid = request.QueryString("VIOSel1")
subeventid = request.QueryString("subvioSel1")
cyear = request.QueryString("cyear")
searchallevent = request.QueryString("searchall")
Dim startdate = request.QueryString("startdate")
Dim enddate = request.QueryString("enddate")

if cint(eventid).ToString() = 0 then
searchtype = 0
else
if cint(subeventid) = 0 then
searchtype = 1
else
searchtype = 2
end if
end if
Dim Command1__startdate
Command1__startdate = startdate

Dim Command1__enddate
Command1__enddate = enddate

%>

Nov 19 '05 #1
1 2826
your conversion is strange. Your source line says >if cint(eventid) = 0
then
while your destination line says >if cint(eventid) = "0" then

In the source line, you are taking a string (eventid) and converting to an
integer, and comparing against zero (note that cint will return a zero for
any non-numeric value, including a null string). In the new line, you are
taking a string, converting to an integer, and then comparing against the
string "0" which is not valid. In addition, the cint() function may not be
as forgiving in vb.net as it was in vb.

Why not check to make sure that the value isn't null or non-numeric, instead
of attempting to convert it and looking for a failure?

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
<am*******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I am gettign this error, while migration an app to asp.net

Exception Details: System.FormatException: Input string was not in a
correct format.

Source Error:

Line 19: Dim enddate = request.QueryString("enddate")
Line 20:
Line 21: if cint(eventid) = "0" then
Line 22: searchtype = 0
Line 23: else
Source File: C:\Documents and
Settings\amit\WebSite1\reports\loc_summary_calc.as px Line: 21

Stack Trace:

[FormatException: Input string was not in a correct format.]
Microsoft.VisualBasic.CompilerServices.Conversions .ParseDouble(String
Value, NumberFormatInfo NumberFormat) +216
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String
Value) +91[InvalidCastException: Conversion from string "ns" to type
'Integer' is not valid.]
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(String
Value) +247
Microsoft.VisualBasic.CompilerServices.Conversions .ToInteger(Object
Value) +988
ASP.loc_summary_calc_aspx.__Render__control1(HtmlT extWriter __w,
Control parameterContainer) in C:\Documents and
Settings\amit\WebSite1\reports\loc_summary_calc.as px:21
System.Web.UI.Control.RenderChildrenInternal(HtmlT extWriter writer,
ICollection children) +98
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +20
System.Web.UI.Page.Render(HtmlTextWriter writer) +27
System.Web.UI.Control.RenderControlInternal(HtmlTe xtWriter writer,
ControlAdapter adapter) +53
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
ControlAdapter adapter) +278
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24The code
isdim eventid, subeventid, cyear, searchalleventeventid =
request.QueryString("VIOSel1")subeventid =
request.QueryString("subvioSel1")cyear =
request.QueryString("cyear")searchallevent =
request.QueryString("searchall")Dim startdate =
request.QueryString("startdate")Dim enddate =
request.QueryString("enddate")
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+8937

The code is as follows,
<%
dim searchtype
'0 - search all zone
'1 - search by zone
'2 - search by location

dim eventid, subeventid, cyear, searchallevent

eventid = request.QueryString("VIOSel1")
subeventid = request.QueryString("subvioSel1")
cyear = request.QueryString("cyear")
searchallevent = request.QueryString("searchall")
Dim startdate = request.QueryString("startdate")
Dim enddate = request.QueryString("enddate")

if cint(eventid).ToString() = 0 then
searchtype = 0
else
if cint(subeventid) = 0 then
searchtype = 1
else
searchtype = 2
end if
end if
Dim Command1__startdate
Command1__startdate = startdate

Dim Command1__enddate
Command1__enddate = enddate

%>

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
21059
by: Jim | last post by:
im using asp.net, C# to enter data into a table in sql server...however im getting this error: Input string was not in a correct format. Description: An unhandled exception occurred during the...
0
768
by: lianfe_ravago | last post by:
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...
5
2497
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string...
1
1824
by: amitbadgi | last post by:
Welcome back amitbadgi | Logout | Faq Knowledge Discovery Keys COMPUTER PROGRAMMING, DATA MINING, STATISTICS, ARTIFICIAL INTELLIGENCE * Settings * Photos * Lists * MVPs * Forums * Blogs
0
2523
by: hudhuhandhu | last post by:
have got an error which says Input string was not in a correct format. as follows.. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
0
11943
by: Anonieko | last post by:
Are there any javascript codes there? Answer: Yes On the PageLoad event call InitialClientControsl as follows /// <summary> /// This will add client-side event handlers for most of the...
0
3152
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also...
1
4504
by: sehguh | last post by:
Hello folks I have recently been studying a book called "sams teach yourself asp.net 2.0 in24 hours by scott mitchell. I have reached page 614 but when i tried to run an asp page called...
1
4728
by: differentsri | last post by:
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT? CAN U TELL THE REASON ? IT IS GIVING THE FOLLOWING ERROR BELOW I HAVE ALSO GIVEN THE CODE OF...
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6998
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5460
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.