You are just returning a single value from a query. This could be done using ExecuteScalar instead of building and filling a DataSet and its table
public string Sequence(Int32 userId)
{
//load the List one time to be used thru out the intire application
var ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["EMSJConnectionString"].ConnectionString;
using (SqlConnection connStr = new SqlConnection(ConnString))
{
using (SqlCommand cmd = new SqlCommand("get_LoginStatusQ", connStr))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserId", userId);
cmd.Connection.Open();
object result = cmd.ExecuteScalar();
return result == null ? string.Empty : result.ToString()
}
}
}
now the call is simply
string status = Sequence(Convert.ToInt32(Session["userid"]))
if(status == "In")
{
}
else
{
}
The only thing to look for is the return value from the ExecuteScalar that could be null if the query doesn't find the user with the given ID