CONNECTION TO A SPECIFIC ACCESS TABLE

  • Thread starter Thread starter dubiousp
  • Start date Start date
D

dubiousp

Guest
Good morning I beleieve my connection to the DB works but when I point to a table I recieve an error

My DB is CDM1 table is users

CDM1.Users

connection.Open();

OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "select * from CDM1.Users where User Name='" + tbusername.Text + "' and Password='" + tbpw.Text + "'";


OleDbDataReader reader = command.ExecuteReader();
int count = 0;
while (reader.Read())

{
count = count + 1;
}
if (count == 1)
{
MessageBox.Show("Correct");
}

if (count > 1)
{
MessageBox.Show("Wrong");
}
else
{ }

Continue reading...
 
Back
Top