hello friend i need one help
i have a three tier architecture
in BEL.cs
public string ID { get; set; }
public string Name { get; set;}
public decimal Salary{get;set;}
in BLL.cs
public string insertdata(BEL objinsertdata)
{
DLL obj = new DLL();
return obj.insertdatadll(objinsertdata);
and in DLL.cs
public string insertdatadll(BEL obj)
{
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=master;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("proapmc1", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@ID", SqlDbType.VarChar, 22));
cmd.Parameters["@ID"].Value = obj.ID;
cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.VarChar, 44));
cmd.Parameters["@Name"].Value = obj.Name;
cmd.Parameters.Add(new SqlParameter("@Salary", SqlDbType.Decimal, 7));
cmd.Parameters["@Salary"].Value = obj.Salary;
string str = "";
cmd.Parameters.Add(new SqlParameter("@Error", SqlDbType.VarChar, 34));
cmd.Parameters["@Error"].Direction=ParameterDirection.Output;
cmd.ExecuteNonQuery();
str = (string)cmd.Parameters["@Error"].Value.ToString();
return str;
}
and in sql field i have taken decimal in salary , ID in varchar(22), and name also varchar(33)
but once i run this codes so i am getting a error in salary field "Input string was not in a correct format."
please tell me where i am wrong and what i am missing