I have this code which is used by a login in a Winforms app.
String query = "SELECT * FROM Accs WHERE email = '" + richTextBox1.Text + "' AND password = '" + richTextBox2.Text + "'";
SqlDataAdapter sda = new SqlDataAdapter(query, conn);
DataTable dtable = new DataTable();
sda.Fill(dtable);
if (dtable.Rows.Count > 0)
{
// the login operation is successful
email = richTextBox1.Text;
pass = richTextBox2.Text;
}
What I want to do is to take the "username" value from the same row.
How can I do that?
This is my accounts table: