I want that value tblpetinfo.petid = tblpetowner.petid and tbladdress.address = tblpetowner.addressid
Can you add a condition for Terms List Box = lbTerm, CheckBox I Agree = chkTerm
Thank!!!
SOURCE CODE:::
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using MySql.Data.MySqlClient;
- using System.Configuration;
-
-
- namespace gpis
- {
- public partial class registrationform : Form
- {
-
- public registrationform()
- {
- InitializeComponent();
- }
-
-
- private void picHome_Click(object sender, EventArgs e)
- {
- menu frm = new menu();
- frm.Show();
-
- this.Hide();
- }
-
-
-
-
- private void bRegister_Click(object sender, EventArgs e)
- {
- try
- {
-
- string dbsource = "datasource=localhost;port=3306;username=root;password=admin1234; database=db_gpis";
-
- MySqlConnection MyConn1 = new MySqlConnection(dbsource);
-
-
- string qpowner = "insert into tblpetowner (polname,pofname,pomi,podob,pogen,pocontact,poemail,addressid) values(@ln,@fn,@mi,@dob,@gen,@cn,@em,addressid);";
-
-
-
- MySqlCommand cmd1 = new MySqlCommand(qpowner, MyConn1);
- cmd1.Parameters.AddWithValue("@ln", tLastname.Text);
- cmd1.Parameters.AddWithValue("@fn", tFirstname.Text);
- cmd1.Parameters.AddWithValue("@mi", tMiddleinitial.Text);
- cmd1.Parameters.AddWithValue("@dob", tDob.Text);
- cmd1.Parameters.AddWithValue("@gen", cmbGender.Text);
- cmd1.Parameters.AddWithValue("@cn", tContactnum.Text);
- cmd1.Parameters.AddWithValue("@em", tEmailadd.Text);
-
-
-
- MySqlDataReader rdr1;
- MyConn1.Open();
- rdr1 = cmd1.ExecuteReader();
-
-
-
-
-
-
-
- MySqlConnection addconn2 = new MySqlConnection(dbsource);
-
- string qaddress = "insert into tbladdress (addressid,hnum,street,brgy,city,region,country,zcode) values(@id,@hn,@st,@brgy,@cty,@re,@coun,@zc);";
-
-
-
-
- MySqlCommand cmd2 = new MySqlCommand(qaddress, addconn2);
- cmd2.Parameters.AddWithValue("@id", null);
- cmd2.Parameters.AddWithValue("@hn", tHousenum.Text);
- cmd2.Parameters.AddWithValue("@st", tStreet.Text);
- cmd2.Parameters.AddWithValue("@brgy", tBrgy.Text);
- cmd2.Parameters.AddWithValue("@cty", cmbCity.Text);
- cmd2.Parameters.AddWithValue("@re", cmbRegion.Text);
- cmd2.Parameters.AddWithValue("@coun", cmbCountry.Text);
- cmd2.Parameters.AddWithValue("@zc", tZipcode.Text);
-
- MySqlDataReader rdr2;
- addconn2.Open();
- rdr2 = cmd2.ExecuteReader();
-
-
-
-
-
-
-
- MySqlConnection addconn3 = new MySqlConnection(dbsource);
-
- string qpet = "insert into tblpetinfo (petid,petname, petcolor, petgen, ptype, pbreed) values(@id,@pn,@pc,@pg,@pt,@pb);";
-
-
-
-
- MySqlCommand cmd3 = new MySqlCommand(qpet, addconn3);
- cmd3.Parameters.AddWithValue("@id", null);
- cmd3.Parameters.AddWithValue("@pn", tPetname.Text);
- cmd3.Parameters.AddWithValue("@pc", tPetcolor.Text);
- cmd3.Parameters.AddWithValue("@pg", cmbPetgender.Text);
- cmd3.Parameters.AddWithValue("@pt", cmbType.Text);
- cmd3.Parameters.AddWithValue("@pb", cmbBreed.Text);
-
-
- MySqlDataReader rdr3;
- addconn3.Open();
- rdr3 = cmd3.ExecuteReader();
-
-
- MessageBox.Show("Successful account registered");
- menu menuForm = new menu();
- menuForm.Show();
- this.Hide();
-
-
- while (rdr3.Read())
- {
-
- }
- addconn3.Close();
-
-
-
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- }