private void button3_Click(object sender, EventArgs e) { PhotoDiary photodiary = new PhotoDiary(); this.Hide(); photodiary.Show(); }
private void button2_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString); connection.Open(); string sql = "SELECT * FROM users WHERE id=" + Convert.ToInt32(idtextBox1.Text); SqlCommand command = new SqlCommand(sql, connection); SqlDataReader reader = command.ExecuteReader(); if (reader.Read()) { PhotoDiary photoDiary = new PhotoDiary(); this.Hide(); photoDiary.Show(); } else { MessageBox.Show("User does not found!"); } connection.Close(); }