//Who is trying to log on? String sUserName = TextBoxUserName.Text; String sPassword = TextBoxPassword.Text; //Does this user exist in the database? string sCommand = "SELECT UserID FROM Users where " + "UserName = \'" + sUserName + "\' " + "and Pwd = \'" + sPassword + "\'"; //If you are using Microsoft Access, type these lines string sConn = "Provider=Microsoft.JET.OLEDB.4.0;" + "data source=C:\\Documents and Settings\\Administrator\\My Documents\\TopSecret.mdb"; System.Data.OleDb.OleDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(sConn); System.Data.OleDb.OleDbDataAdapter dataAdapter = new System.Data.OleDb.OleDbDataAdapter(); dataAdapter.SelectCommand = new System.Data.OleDb.OleDbCommand(sCommand, dbConnection); DataSet ds = new DataSet(); dataAdapter.Fill(ds); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { LabelFeedback.Text = "You are not a Top Secret user."; } else { LabelFeedback.Text = sUserName + " is a Top Secret user."; }