I have the following code in class SQL
Expand|Select|Wrap|Line Numbers
- public void ExecuteReadQuery(string ReadQuery)
- {
- if (dbconn == null)
- return;
- OleDbDataReader dr;
- OleDbCommand cmd = new OleDbCommand();
- dr = cmd.ExecuteReader();
- if (dr.HasRows == true)
- return;
- try
- {
- dbconn.Open();
- }
- catch (Exception ex)
- {
- dbconn.Close();
- throw new CSMException(ex.Message, ex.Message);
- }
- finally
- {
- dbconn.Close();
- }
- }
The code of the login form is posted below:
Expand|Select|Wrap|Line Numbers
- SQL sql = new SQL();
- sql.ExecuteReadQuery("SELECT Username, Password FROM Users WHERE Username = "+user + "AND pass = "+pass);
Expand|Select|Wrap|Line Numbers
- if ()
- {
- using (MainMenu MainMenu = new MainMenu())
- {
- Hide();
- MainMenu.ShowDialog();
- Environment.Exit(0);
- }
- }