I have a page which is developed in ASP.NET and C#. On this particular page the logged in users can see who their manager is and the manager contact details etc. The details are being retrieved from a database. I am using the following code
protected string ManagerData()
{
string UsrName = User.Identity.Name;
string mName;
string mNum;
using (SqlConnection connection = new SqlConnection(Common.ConnectionString))
{
using (SqlCommand cmd = new SqlCommand("select ManagerName,ManagerNumber from Managers where UserName=@UserName"))
{
SqlParameter para = new SqlParameter("UserName", UsrName);
cmd.Parameters.Add(para);
cmd.Connection = connection;
connection.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
reader.Read();
mName = reader.GetString(0);
mNum = reader.GetString(1);
}
}
}
return //How would i return both of the string
}
It returns the values. To display them I use the following code
<h5>Your Manager is:<%:ManagerData() %> </h5>
But if I do
<h5>Your Managers Number is:<%:ManagerData() %> </h5>
It returns the name of Manager in both cases. So my question is should I write a separate method to get the managers number or is there a way to return two strings from the above method?
Thanks in advance for all your help and support