hi for all i have problem in my application i try on it for two days first off i make procedure in database i sure of it procedure hasn't problem after that i make function in bll class
public static DataTable getbyidBLL(ClsresempDAL obj)
{
try
{
string _spName1 = "ResEmp"; // storedprocedure name
string _mode = "getbyid"; // Method name in storedprocedure
DBBridge objDBBridge = new DBBridge();//
SqlParameter[] param = new SqlParameter[2];
param[0] = new SqlParameter("@id", obj.Emp_ID);
param[1] = new SqlParameter("@mode", _mode);
DataTable ds = new DataTable();
ds = objDBBridge.ExecuteDataset(_spName1, param).Tables[0];
return ds;
}
catch (Exception exp)
{
// clsErrorLog.log_error(exp);
DataTable ds = new DataTable();
return ds;
}
}
mr.crazy
Member
34 Points
79 Posts
There is no row at position 0
Apr 29, 2012 07:49 AM|LINK
hi for all i have problem in my application i try on it for two days first off i make procedure in database i sure of it procedure hasn't problem after that i make function in bll class
public static DataTable getbyidBLL(ClsresempDAL obj) { try { string _spName1 = "ResEmp"; // storedprocedure name string _mode = "getbyid"; // Method name in storedprocedure DBBridge objDBBridge = new DBBridge();// SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@id", obj.Emp_ID); param[1] = new SqlParameter("@mode", _mode); DataTable ds = new DataTable(); ds = objDBBridge.ExecuteDataset(_spName1, param).Tables[0]; return ds; } catch (Exception exp) { // clsErrorLog.log_error(exp); DataTable ds = new DataTable(); return ds; } }and then i call it in DAL class
public void getbyid() { DataTable dt = new DataTable(); dt = ClsResEmpBLL.getbyidBLL(this); DataRow dr = dt.Rows[0]; Emp_ID = int.Parse(dr["Emp_ID"].ToString()); ResEmpCivilID = int.Parse(dr["ResEmpCivilID"].ToString()); ResEmpName = dr["ResEmpName"].ToString(); Grade = int.Parse(dr["Grade"].ToString()); PerTypeID = dr["PerTypeID"].ToString(); SectionID = int.Parse(dr["SectionID"].ToString()); User_name = dr["user_name"].ToString(); }then in gridview row command i add this code
f (e.CommandName.ToString() == "edit0") { cc.Emp_ID = int.Parse(e.CommandArgument.ToString()); cc.getbyid(); }when i execute the error message appear to me There is no row at position 0. in getbyid in dal class any one can help me
thanks