Saturday, July 11, 2020

Get Value from Datatable

in c# if you get Datatable in single row, it is easy to get the values.
You dont need to map the class.



var param = new { @AccCode = entity.SalaryAccCode };
                var empList = employeeSPService.GetDataWithParameter(param, "SP_PR_Get_AccData");

           
                if (empList.Tables[0].Rows.Count > 0)
                {
                    var v = empList.Tables[0].Rows[0]["AccountCode"].ToString();
                    var AccountName = empList.Tables[0].Rows[0]["AccountName"].ToString();
                    entity.AccountName = AccountName;

                }

No comments:

Post a Comment

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.