private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("please Enter publisher name and publisher mail"); } else { con.Open(); SqlCommand cm = new SqlCommand("check_publisher", con); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.Add(new SqlParameter("@publishername", textBox2.Text)); cm.Parameters.Add(new SqlParameter("@publishermail", textBox1.Text)); SqlParameter output = new SqlParameter("@@out", SqlDbType.NVarChar); output.Direction = ParameterDirection.Output; output.Size = 50; cm.Parameters.Add(output); cm.ExecuteNonQuery(); if (cm.Parameters["@@out"].Value is System.DBNull) { SqlCommand cmd = new SqlCommand(@"insert into publisher (publisher_name,publisher_mail,p_code,p_phone_number)values(@name,@mail,@code,@phone)", con); cmd.Parameters.Add(new SqlParameter("@name", textBox2.Text)); cmd.Parameters.Add(new SqlParameter("@mail", textBox1.Text)); cmd.Parameters.Add(new SqlParameter("@code", textBox3.Text)); cmd.Parameters.Add(new SqlParameter("@phone", textBox4.Text)); cmd.ExecuteNonQuery(); } else if (cm.Parameters["@@out"].Value.ToString() == "true") { MessageBox.Show("the name or mail is already exist"); Form7 f = new Form7(); f.Show(); this.Hide(); } con.Close(); } }
private void button1_Click_1(object sender, EventArgs e) { if (comboBox1.Text == "Book") { form5 fff = new form5(); fff.Show(); } else if (comboBox1.Text == "User") { Form6 f = new Form6(); f.Show(); } else if (comboBox1.Text == "Author") { Form8 f = new Form8(); f.Show(); } else if (comboBox1.Text == "Publisher") { Form7 f = new Form7(); f.Show(); } }