Elegabalus
Programmer
Probably a simple question: I've got a dataset of data I'm getting from a database.
I want to be able to make some changes to the results based on certain criteria (i.e., pseudocode: if employeeID in (1,2,3,4,5) then employeename = employeename + " - manager"
Problem is that I'm not sure how to do this to a dataset.
This doesn't work...it only returns the dataset straight form the database.
The output should be:
Bill - manager
Joe - manager
Jeff
Bob
However, it is:
Bill
Joe
Jeff
Bob
Any help is appreciated.
I want to be able to make some changes to the results based on certain criteria (i.e., pseudocode: if employeeID in (1,2,3,4,5) then employeename = employeename + " - manager"
Problem is that I'm not sure how to do this to a dataset.
Code:
public DataSet GetEmps()
{
clsEmps all_emps = new clsEmps();
DataSet dsEmps = all_emps.dsAllEmps();
if (dsEmps.Tables.Count > 0)
{
foreach (DataRow row in dsEmps.Tables[0].Rows)
{
if (row["EmpID"].ToString() == "1" || row["EmpID"].ToString() == "2")
{
_strEmp_Name = row["Emp_Name"].ToString() + " - manager";
}
else
{
_strEmp_Name = row["Emp_Name"].ToString();
}
}
}
else
{
_strEmp_Name = "";
}
return dsEmps;
}
This doesn't work...it only returns the dataset straight form the database.
The output should be:
Bill - manager
Joe - manager
Jeff
Bob
However, it is:
Bill
Joe
Jeff
Bob
Any help is appreciated.