private void btnLogin_Click(object sender, EventArgs e) { NpgsqlConnection conn = new NpgsqlConnection("Server=localhost;Port=5432;User Id=postgres;Password=yamin-mmocc;Database=MMOCC_Bulletin"); conn.Open(); NpgsqlCommand cmd = new NpgsqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select * from tbl_users where UserId = @id AND UserPassword = @password"; cmd.Parameters.AddWithValue("id", txtuserID.Text.ToString()); cmd.Parameters.AddWithValue("password", txtpassword.Text.ToString()); NpgsqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { User.UserID = txtuserID.Text.Trim().ToString(); while (dr.Read()) { User.UserNo = dr.GetValue(0).ToString(); // On first iteration will be hello } this.Hide(); NoteList f3 = new NoteList(); //this is the change, code for redirect f3.Show(); } else { MessageBox.Show("User name or password is invalid."); } }
private void noteListToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); NoteList f1 = new NoteList(); //this is the change, code for redirect f1.ShowDialog(); }
private void btnCancel_Click(object sender, EventArgs e) { this.Hide(); NoteList f = new NoteList(); //this is the change, code for redirect f.ShowDialog(); }