hi,
i created one aspx page that contains datagrid(properties: showfooter-true) and button(name: add record) controls, when i click the button it shows specified argument was out of range of values and my code is...plz clarify my doubt
here am using stored procedure for inseting values into database
protected void Button1_Click(object sender, EventArgs e)
{
GridViewRow r = GridView1.FooterRow;
int newempid, newesalary;
string newename, neweprofession, newedept;
DateTime newdateofjoining;
TextBox t1 = (TextBox)r.Cells[0].Controls[0];
newempid = Convert.ToInt32(t1.Text);
t1 = (TextBox)r.Cells[1].Controls[0];
newename = t1.Text;
t1 = (TextBox)r.Cells[2].Controls[0];
neweprofession = t1.Text;
t1 = (TextBox)r.Cells[3].Controls[0];
newdateofjoining = Convert.ToDateTime(t1.Text);
t1 = (TextBox)r.Cells[4].Controls[0];
newesalary = Convert.ToInt32(t1.Text);
t1 = (TextBox)r.Cells[5].Controls[0];
newedept = t1.Text;
cmd = new SqlCommand("insrtrow", con);
cmd.CommandType = CommandType.StoredProcedure;
p = new SqlParameter("@empid", SqlDbType.Int);
p.Value = newempid;
cmd.Parameters.Add(p);
p = new SqlParameter("@ename", SqlDbType.VarChar);
p.Value = newename;
cmd.Parameters.Add(p);
p = new SqlParameter("@eprofession", SqlDbType.VarChar);
p.Value = neweprofession;
cmd.Parameters.Add(p);
p = new SqlParameter("@dateofjoining", SqlDbType.DateTime);
p.Value = newdateofjoining;
cmd.Parameters.Add(p);
p = new SqlParameter("@esalary", SqlDbType.Int);
p.Value = newesalary;
cmd.Parameters.Add(p);
p = new SqlParameter("@edept", SqlDbType.VarChar);
p.Value = newedept;
cmd.Parameters.Add(p);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}