private void Form1_Load(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { try { string sconnection; sconnection = "provider=microsoft.jet.oledb.4.0;" + "data source=intuitive.mdb"; OleDbConnection dbconn; dbconn = new OleDbConnection(sconnection); dbconn.Open(); OleDbCommand cmd = new OleDbCommand(); OleDbDataReader dr = null; dr = cmd.ExecuteReader(); cmd.CommandText = "select * from table"; // dr = cmd.ExecuteReader(); string userText = textBox1.Text; string passText = textBox2.Text; while (dr.Read()) { if (this.CompareStrings(dr["username"].ToString(), userText) && this.CompareStrings(dr["password"].ToString(), passText)) { MessageBox.Show("OK"); } else { MessageBox.Show("Error"); } } dr.Close(); dbconn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
dr = cmd.ExecuteReader(); cmd.CommandText = "select * from table";
cmd.CommandText = "select * from table"; dr = cmd.ExecuteReader();
cmd.Connection = dbconn
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\intuitive.mdb;User Id=UserID;Password=PWD;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)