|
The error appears like this -->
Server Error in '/' Application.
--------------------------------------------------------------------------------
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.
Stack Trace:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7469351
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
System.Web.UI.WebControls.ImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection) +163
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +14
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +693
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
|
|
|
|
|
What was the input string? Is there any special character on that string ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi Abhijit,
Even on entering special charatcers , report is working fine. I cant fnd this error on local and only once on server but my clients have reported it many times. I am not undertaking any data conversions. I have text boxes for dates and i have tested it several times they are working fine. Even I cant understand why this error is coming as on local and even on server i cant find this error except only 1 time with all types of input.
|
|
|
|
|
devesh sinha wrote: I cant fnd this error on local and only once on server but my clients have reported it many times.
Then why you are not asking client for data and tested with those data. I think there may be some script problem.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
On this page i have only two textboxes for input that are used for entering dates. And i have tested it with every type of incorrect input. It is not giving any error.
|
|
|
|
|
Did you tried with this < >
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Have you tried steppg through the code ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
What is the retuen type of your function ?? and if exception occurs then what are you returning ??
If you dont know the meaning of what I am asking you please post your function here and the line from where you have called the function !!
Thanks,
Arindam D Tewary
|
|
|
|
|
Hi,
Here is my code.
<code>
public partial class SCSFMS_Pages_VisitLog : System.Web.UI.Page
{
Common cmn = new Common();
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
SessionExpiresCheckOnButton();
try
{
hiUid.Text = Session["Usr_Id"].ToString();
hidUtype.Text = Session["UserType"].ToString();
string curdt = System.DateTime.Now.AddHours(13).ToString("dd/MM/yyyy");
string entrydt = cmn.DDMMYYtoMMDDYY(curdt);
txtDate.Text = curdt;
txtVisitDtto.Text = curdt;
if (hidUtype.Text == "A")
{
cmn.fillDDL(ddlUser, "select u.Usr_Id,u.UName from users u, userdetail ud where u.status ='Active' and ud.designationid in (2,4,12) and ud.id=u.usr_id order by UName", "Usr_Id", "UName");
}
string desigid = cmn.nDesgID(hiUid.Text).ToString();
if (hidUtype.Text == "U")
{
if (desigid == "6")
{
cmn.fillDDL(ddlUser, "select u.Usr_Id,u.UName from users u, userdetail ud where u.status ='Active' and ud.id=u.usr_id and (ud.id ="+hiUid.Text+" or ud.admintoreport="+hiUid.Text+") order by UName", "Usr_Id", "UName");
}
else
{
cmn.fillDDL(ddlUser, "select u.Usr_Id,u.UName from users u, userdetail ud where u.status ='Active' and ud.id=u.usr_id and (ud.id =" + hiUid.Text + ") order by UName", "Usr_Id", "UName");
ddlUser.SelectedIndex= 1;
ddlUser.UpdateAfterCallBack = true;
}
}
}
catch (Exception ex)
{
return;
}
}
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
try
{
fillgrid();
}
catch (Exception ex)
{
return;
}
}
public void fillgrid()
{
try
{
string usrsearch = "";
string sqlprt = "";
string desigid = cmn.nDesgID(hiUid.Text).ToString();
if (ddlUser.SelectedValue != "0")
{
usrsearch = ddlUser.SelectedValue.ToString();
sqlprt = "and ud.usr_id = "+usrsearch+" ";
}
lblResult.Visible = false;
lblResult.UpdateAfterCallBack = true;
string myentrydt = cmn.DDMMYYtoMMDDYY(txtDate.Text.ToString());
string mydtto = cmn.DDMMYYtoMMDDYY(txtVisitDtto.Text.ToString());
string sql = "";
if (hidUtype.Text == "A")
{
sql = " select ud.uname,amt= case when sum(od.prod_amt) is null then '0' else sum(od.prod_amt)end ,totalcall=count(*),visitdate=convert(varchar(12), ov.visit_date ,6) from tblSCSFMS_OrderVisit_Master ov " +
" left join users ud on ud.usr_id = ov.usr_id " +
" left join tblSCSFMS_Order_Details od on od.visit_id =ov.visit_id " +
" where CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) >= '" + myentrydt + "' and CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) <= '" + mydtto + "' " +
" " +(sqlprt)+ " group by ud.uname , ov.visit_date, ov.usr_id ";
}
else
{
if (desigid == "6" && ddlUser.SelectedValue != "0")
{
sql = " select ud.uname,amt= case when sum(od.prod_amt) is null then '0' else sum(od.prod_amt)end ,totalcall=count(*),visitdate=convert(varchar(12), ov.visit_date ,6) from tblSCSFMS_OrderVisit_Master ov " +
" left join users ud on ud.usr_id = ov.usr_id " +
" left join tblSCSFMS_Order_Details od on od.visit_id =ov.visit_id " +
" where CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) >= '" + myentrydt + "' and CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) <= '" + mydtto + "' " +
" " + (sqlprt) + " group by ud.uname , ov.visit_date, ov.usr_id ";
}
else
{
sql = " select ud.uname,amt= case when sum(od.prod_amt) is null then '0' else sum(od.prod_amt)end ,totalcall=count(*),visitdate=convert(varchar(12), ov.visit_date ,6) from tblSCSFMS_OrderVisit_Master ov " +
" left join users ud on ud.usr_id = ov.usr_id " +
" left join userdetail udtl on udtl.id = ov.usr_id " +
" left join tblSCSFMS_Order_Details od on od.visit_id =ov.visit_id " +
" where CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) >= '" + myentrydt + "' and CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) <= '" + mydtto + "' and (ud.usr_id = " + hiUid.Text.Trim() + " or udtl.admintoreport = " + hiUid.Text.Trim() + ")" +
" group by ud.uname , ov.visit_date, ov.usr_id";
}
}
cmn.fillGridView_By_USP(gdS_AddUser, sql);
if (!gdS_AddUser.Rows.Count.Equals(0))
{
// lblResult.Text = "Search Result";
lblResult.Visible = false;
lblResult.UpdateAfterCallBack = true;
}
else
{
lblResult.Text = "No Data found for the above search criteria.";
lblResult.Visible = true;
lblResult.UpdateAfterCallBack = true;
}
}
catch (Exception ex)
{
return;
}
}
protected void gdS_AddUser_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gdS_AddUser.PageIndex = e.NewPageIndex;
fillgrid();
}
private void SessionExpiresCheckOnButton()
{
try
{
if (Session["Usr_Id"].ToString() == "" || Session["Usr_Id"].ToString() == null)
{
Session["ExpireMsg"] = "true";
Response.Redirect("../../index.aspx?urlvalue1=SCSFMS");
return;
}
}
catch (Exception)
{
Session["ExpireMsg"] = "true";
Response.Redirect("../../index.aspx?urlvalue1=SCSFMS");
return;
}
}
The error it is giving is "Input String is not in Correct Format." to some of my clients. But i havn't received this error yet even on thorough testing of the page.
|
|
|
|
|
try to catch me if you can
some one is eating the exception. If the exception is not re-thrown then there is nothing you can do.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hiya everybody! I need some help trying to find out why is my WS not working as I want it to. I'm newbie when it comes to WebServices.
I got one that helps me get a DataSet so I can work with disconnected data.
public DataSet WSfnGetInfo(string strQuery, string strName, string strClientUser, string strClientPassword)
{
strUser = strClientUser;
strPassword = strClientPassword;
fnCreateCS();
SqlDataAdapter dAdapter = new SqlDataAdapter(strQuery, connString );
DataSet dsInfo = new DataSet();
dAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
try
{
dAdapter.Fill(dsInfo, strName);
}
catch(SqlException ex)
{
System.Web.HttpContext.Current.Response.Write(ex.Message);
return null;
}
return dsInfo;
}
Then I got my client WinApp in which I use this code to show the dataset on datagridview.
myServ.Service myService = new myServ.Service();
try
{
dsMeals = myService.WSfnGetInfo("SELECT * FROM dbo.MEALS", "MEALS", f1ref.user, f1ref.password);
dataGridView1.DataSource = dsMeals;
dataGridView1.DataMember = "MEALS";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " " + ex.HelpLink + " " + ex.Data);
}
I can't get to show the data in datset in gridview. I get an error that the "Respons/Answer is not correct XML code". I'm stuck there.
From what I've read, returning DataSet from a WS ain't the best practice due nature of XML WSs and that it is too much text.
Any help is appreciated.
I'm using this as a reference http://msdn.microsoft.com/en-us/library/s5xy331f(VS.80).aspx[^]
|
|
|
|
|
hi,
i am new to this code project.
now am developing multi users login page,
i need some code to develop.
kindly do the needfull.
Thanks in advance.
regards,
lakshmi
|
|
|
|
|
cemalakshmi wrote: i am new to this code project.
Welcome to CodeProject !
cemalakshmi wrote: now am developing multi users login page,
i need some code to develop.
kindly do the needfull.
Buy some beginners Book, start reading and try it yourself. If stuck, then ask here. you will get lots of help other wise not
You can Check Here
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi All,
Do we have a inbuilt function in .Net or DotNetNuke to get the list of countries available. i need to fill it in a dropdown list and i need to avoid webservice which returns list of countries.
Thanks,
Maxy.
|
|
|
|
|
Any reason you can't just hard code it ? I mean, even if the list changes, if you won't call a webservice, it's a hard coded list you're expecting to end up with, right ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
there is no any function in asp.net,you have to search counry list from web, and store in your databse,from there you set datsource tool to fetch up in dropdown list.
i hope you wil satisfy my answer
thanking you
wqqwqw
|
|
|
|
|
|
Please give me link to download visual studio 2005 on my pc.
|
|
|
|
|
bhavna4321 wrote: Please give me link to download visual studio 2005 on my pc.
Why ? google is not working there ? And how does it make sense to put this question in ASP.NET Forum ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Damn - every time I think we've found the stupidest person, someone new comes up. You, sir, are scum. Buy the software, and once you do, please don't come here with your clueless questions, you're obviously too stupid to actually use Visual Studio.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
logon to www.microsoft.com
and search step to download visul studio.
thanks
wqqwqw
|
|
|
|
|
Hello,
Dim vfpConn As OleDbConnection = New OleDbConnection("Provider=VFPOLEDB.1; Data Source='C:\Inetpub\wwwroot\Election\ps5.dbf';") ' is running fine
but,
Dim vfpConn As OleDbConnection = New OleDbConnection("Provider=VFPOLEDB.1; Data Source='http://girish/election/data1.dbc';") 'is returning error (Invalid path or file name.)
vfpConn.Open()
Dim sVfp As String = "select * from ps5"
Dim oCmd As New OleDbCommand(sVfp, vfpConn)
How can i use VFP table as datasource using http://girish/<myapplication folder="" at="" web="" server="">/tablename.dbf ?
Thanks & Regards
Girish Sharma
|
|
|
|
|
perhaps you need write access ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Thanks for your reply.
So, how do i set write access. Please guide me.
Thanks & Regards
Girish Sharma
|
|
|
|
|
Hi,
I have an aspx page that contains a web part and a fileupload control within the web part. I have also added a label that display the status of the upload. I wanted to put the lable inside an Update Panel and then display the correct string value when I click the upload button but I keep getting an "Object is not set to an instance" error. The code for mybutton event looks like this:
try
{
string fileName = fuFileUpload.PostedFile.FileName; (THIS IS WHERE IT FAILS...) string contentType = fuFileUpload.PostedFile.ContentType;
string getFileName = System.IO.Path.GetFileName(fileName);
string userName = Page.User.Identity.Name;
Stream fileStream = fuFileUpload.PostedFile.InputStream;
Byte[] fileBuffer = new byte[1024];
while (fileStream.Read(fileBuffer, 0, fileBuffer.Length) > 0)
{
fuFileUpload.PostedFile.SaveAs(Server.MapPath("UploadedFiles\\") + userName + "_" + getFileName);
}
fileStream.Close();
lblProgress.Text = UploadSuccess;
}
catch (Exception ex)
{
ex.Message.ToString();
}
When I remove the UpdatePanel everything works fine. I then proceeded to wrap the whole wep part within the Update Panel to see if this works and I get the same error.
My question is this, Can you nest a control inside a web part and the web part inside an update panel?
Illegal Operation
|
|
|
|
|