Amjad Fiaz
asked on
Failed to convert parameter value from a String to a Int32.
<b>I'm trying</b>
int ist = EAdapter.Insert(txtclgname .Text,
txtErlno.Text, drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Tex t,
drpPassyear.SelectedItem.T ext, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.T ext, txtExSkill.Text, resume);
<b>how to fixed it</b>
int ist = EAdapter.Insert(txtclgname
txtErlno.Text, drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Tex
drpPassyear.SelectedItem.T
<b>how to fixed it</b>
if all your parameters are correct, then make sure this function "EAdapter.Insert(...)" returns integer value all the time...
or try
to see if it works...
or try
string ist = EAdapter.Insert(...);
to see if it works...
ASKER
Its Not Working
Hi Amjad Fiaz,
Could you please try the below code and confirm.
Could you please try the below code and confirm.
int ist = Convert.ToInt32(EAdapter.Insert(txtclgname.Text, txtErlno.Text, drpsem.SelectedItem.Text, drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text,
drpPassyear.SelectedItem.Text, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume));
Its Not Workingmeaning what? what error mesage do you get?
put a breakpoint on that line
EAdapter.Insert(...)
and check all parameter values...
are they correct?
what does that function return, an integer, are you sure?
what is code for that function?
If possible could you please share us the more code ?
ASKER
protected void btnsbmit_Click(object sender, EventArgs e)
{
lblEdu.Text = "";
lblBranch.Text = "";
lblPassyr.Text = "";
lblSkill.Text = "";
lblmsg.Text = "";
lblResume.Text = "";
if (drpsem.SelectedIndex == 0)
{
lblsem.Text = "!!!";
}
else if (drpEdu.SelectedIndex == 0)
{
lblEdu.Text = "!!!";
}
else if (drpBranch.SelectedIndex == 0)
{
lblBranch.Text = "!!!";
}
else if (drpPassyear.SelectedIndex == 0)
{
lblPassyr.Text = "!!!";
}
else if (drpreqskill.SelectedIndex == 0)
{
lblSkill.Text = "!!!";
}
else
{
if (FUResume.HasFile)
{
FUResume.SaveAs(Server.Map Path("~/Re sume/" + FUResume.FileName.ToString ()));
string resume = "~/Resume/" + FUResume.FileName.ToString ();
var test = Convert.ToInt32(Session["S ID"]);
int ist = Convert.ToInt32(EAdapter.I nsert(txtc lgname.Tex t, txtErlno.Text, drpsem.SelectedItem.Text,
drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Tex t,
drpPassyear.SelectedItem.T ext, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.T ext, txtExSkill.Text, resume));
if (ist == 1)
{
lblmsg.Text = "Add successfully..";
clean();
Response.Redirect("Home.as px");
}
}
else
{
lblResume.Text = "!!!";
lblEdu.Text = "";
lblBranch.Text = "";
lblPassyr.Text = "";
}
}
}
{
lblEdu.Text = "";
lblBranch.Text = "";
lblPassyr.Text = "";
lblSkill.Text = "";
lblmsg.Text = "";
lblResume.Text = "";
if (drpsem.SelectedIndex == 0)
{
lblsem.Text = "!!!";
}
else if (drpEdu.SelectedIndex == 0)
{
lblEdu.Text = "!!!";
}
else if (drpBranch.SelectedIndex == 0)
{
lblBranch.Text = "!!!";
}
else if (drpPassyear.SelectedIndex
{
lblPassyr.Text = "!!!";
}
else if (drpreqskill.SelectedIndex
{
lblSkill.Text = "!!!";
}
else
{
if (FUResume.HasFile)
{
FUResume.SaveAs(Server.Map
string resume = "~/Resume/" + FUResume.FileName.ToString
var test = Convert.ToInt32(Session["S
int ist = Convert.ToInt32(EAdapter.I
drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Tex
drpPassyear.SelectedItem.T
if (ist == 1)
{
lblmsg.Text = "Add successfully..";
clean();
Response.Redirect("Home.as
}
}
else
{
lblResume.Text = "!!!";
lblEdu.Text = "";
lblBranch.Text = "";
lblPassyr.Text = "";
}
}
}
ASKER
this is show (System.FormatException: Input string was not in a correct format.)
1. whats the result of
string ist = EAdapter.Insert(...)
2. what is code for this function: EAdapter.Insert(..) at least specification + return part
string ist = EAdapter.Insert(...)
2. what is code for this function: EAdapter.Insert(..) at least specification + return part
hi Amjad Fiaz,
could you please change the data type from int to var and check which value is coming
could you please change the data type from int to var and check which value is coming
var ist = EAdapter.Insert(txtclgname.Text, txtErlno.Text, drpsem.SelectedItem.Text,
drpEdu.SelectedItem.Text, drpBranch.SelectedItem.Text,
drpPassyear.SelectedItem.Text, float.Parse(txtCGPA.Text), drpreqskill.SelectedItem.Text, txtExSkill.Text, resume);
@Tapan
I already suggested this
string ist = EAdapter.Insert(...)
and still waiting for answer... anything can be converted to string... so it does not fail...
I already suggested this
string ist = EAdapter.Insert(...)
and still waiting for answer... anything can be converted to string... so it does not fail...
ASKER
HainKurt It show error argument over loaded..
ASKER
It Show same error System.FormatException: Input string was not in a correct format....
Tapan
Tapan
It show error argument over loaded..
could not get what this mean
when you use this and run
string ist = EAdapter.Insert(...)
what is happening?
also, when you put a breakpoint here, what are all the values you are passing?
also, what is the code for that function? (spec + return part at least)
check number of parameters are same or different for the method EAdapter.Insert(....)
so, original error goes and now this one...
check your function for parameters, and pass appropriate values
and check return type of that function and use that type in your calling code...
check your function for parameters, and pass appropriate values
and check return type of that function and use that type in your calling code...
what is EAdapter, do you have any manual? looks like it is a 3rd party product to me...
and why you did not share the code for that function so far?
and why you did not share the code for that function so far?
ASKER
this._adapter.InsertComman d.CommandT ext = "dbo.INSERT_ADDEDU";
this._adapter.InsertComman d.CommandT ype = global::System.Data.Comman dType.Stor edProcedur e;
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@R ETURN_VALU E", global::System.Data.SqlDbT ype.Int, 4, global::System.Data.Parame terDirecti on.ReturnV alue, 10, 0, null, global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@S ID", global::System.Data.SqlDbT ype.Int, 4, global::System.Data.Parame terDirecti on.Input, 10, 0, "SID", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@C LGNAME", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "CollegeName", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@E RNO", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "EnrallNo", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@S EMESTER", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "semester", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@E DUCATION", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "Education", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@B RANCH", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "Branch", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@P ASSYEAR", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "PassYear", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@C GPA", global::System.Data.SqlDbT ype.Float, 8, global::System.Data.Parame terDirecti on.Input, 53, 0, "CGPA", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@S KILL", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "Skill", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@E XSKILL", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "Skill", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.InsertComman d.Paramete rs.Add(new global::System.Data.SqlCli ent.SqlPar ameter("@R ESUME", global::System.Data.SqlDbT ype.NVarCh ar, 256, global::System.Data.Parame terDirecti on.Input, 0, 0, "Resume", global::System.Data.DataRo wVersion.C urrent, false, null, "", "", ""));
this._adapter.UpdateComman d = new global::System.Data.SqlCli ent.SqlCom mand();
this._adapter.UpdateComman d.Connecti on = this.Connection;
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.InsertComman
this._adapter.UpdateComman
this._adapter.UpdateComman
ASKER
SDS.SELECT_ADDEDUDataTable EDT = new SDS.SELECT_ADDEDUDataTable ();
SDSTableAdapters.SELECT_AD DEDUTableA dapter EAdapter = new SDSTableAdapters.SELECT_AD DEDUTableA dapter();
SDSTableAdapters.SELECT_AD
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
if you send "THIS_IS_NOT_A_NUMBER" for a integer parameter, of course you will get error...