OK so I have two classes in the first class is where the database is handled, in the second class is where I want the output from my database select statment in be displayed on a label. How do I get the result to a label on Invoice.aspx?
DBdatabase.cs
public static void surnameSelect(string Ssession)
{
cmd = new SqlCommand("Select Surname from Users Where Username = '" + Ssession + "'", con);
try
{
con.Open();
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Console.WriteLine("Exception in DBHandler", ex);
}
finally
{
con.Close();
}
}
Invoice.aspx.cs
string b = Session["LoginSession"].ToString();
DBdatabase.ForenameSelect(b);