I have this project I am working on for an assignment, and I have a question working with ASP.NET and SQL Server. I have a login page that kinda works, but there are two tables that I need to get data from - users (subscribers) and admin page but am unsure how to access both of them as I can only access one.
public void login(Object src,EventArgs e)
{
get_connection();
try
{
connection.Open();
command = new SqlCommand("SELECT * FROM subscribers WHERE Email = @Email AND Password = @Password", connection);
command.Parameters.AddWithValue("@Email", loginName.Text);
command.Parameters.AddWithValue("@Password", loginPass.Text);
//command = new SqlCommand("SELECT * FROM admin WHERE Email =@Email and Password = @Password", connection);
//command.Parameters.AddWithValue("@Email", loginName.Text);
//command.Parameters.AddWithValue("@Password", loginPass.Text);
reader = command.ExecuteReader();
I commented out the admin part because when I include it, only admin username and password is accepted and not subscribers. What would I need to do to fix this?
UNIONthe SELECTs.