This is funtion I does:-
value in comboBox represent className's classId
divisionName is a new value I Inserting.
And the error arising is:-
The C# code for this function is:-
public void DivisionAdd(divisionInfo infoDivision)
{
try
{
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();
}
SqlCommand c = new SqlCommand("divisionAdd", sqlCon);
c.CommandType = CommandType.StoredProcedure;
c.Parameters.Add("divisionName", SqlDbType.VarChar).Value = infoDivision.divisionName;
c.Parameters.Add("classId", SqlDbType.Decimal).Value = infoDivision.classId;
int inCount = c.ExecuteNonQuery();
if (inCount > 0)
{
HttpContext.Current.Response.Write("");
}
}
catch (Exception)
{
throw;
}
finally
{
sqlCon.Close();
}
}
Please help me in this topic.

Iftikar HussainPosted Aug 23, 2013, 2:15 AM
Regards,
Iftikar
Iftikar HussainPosted Aug 23, 2013, 1:47 AM
Regards,
Iftikar
Bineesh ViswanathPosted Aug 23, 2013, 1:44 AM
I found where the problem lies.
It was in the divisionInfo.cs file. I just changed copy the classId from tbl_Class and Pasted in
divisionInfo.cs file. Then the problem being solved.
Iftikar HussainPosted Aug 23, 2013, 1:35 AM
SqlCommand c = new SqlCommand("divisionAdd", sqlCon);
c.CommandType = CommandType.StoredProcedure;
c.Parameters.AddWithValue("@divisionName", infoDivision.divisionName);
c.Parameters.AddWithValue("@classId", nfoDivision.classId);
Regards,
Iftikar
Iftikar HussainPosted Aug 23, 2013, 1:22 AM
I think the classId value is not passing properly. Please share the code for passing the classId from your page.
Regards,
Iftikar