public Form1(Int32 intPerson_ID) { InitializeComponent(); //Hide the Add button btnsubmit.Visible = false; btnsubmit.Enabled = false; PersonV2 temp = new PersonV2(); SqlDataReader dr = temp.FindOnePerson(intPerson_ID); while (dr.Read()) { txtfirstname.Text = dr["FirstName"].ToString(); txtmiddlename.Text = dr["MiddleName"].ToString(); txtlastname.Text = dr["LastName"].ToString(); txtstreet1.Text = dr["Street1"].ToString(); txtstreet2.Text = dr["Street2"].ToString(); txtcity.Text = dr["City"].ToString(); txtstate.Text = dr["State"].ToString(); txtzip.Text = dr["Zipcode"].ToString(); txtphone.Text = dr["Phone"].ToString(); txtemail.Text = dr["Email"].ToString(); txtinstagramurl.Text = dr["Instagram"].ToString(); lblpersonid.Text = dr["PersonID"].ToString(); } }
private void btndelete_Click(object sender, EventArgs e) { Int32 intPerson_ID = Convert.ToInt32(lblpersonid.Text); //Get the ID from the Label //Create a EBook so we can use the delete method PersonV2 temp = new PersonV2(); //Use the EBook ID and pass it to the delete function // and get the number of records deleted lblFeedback.Text = temp.DeleteOnePerson(intPerson_ID); }
private void btnsearch_Click(object sender, EventArgs e) { //Get Data PersonV2 temp = new PersonV2(); //Perform the search we created in EBook class and store the returned dataset DataSet ds = temp.SearchPerson(txtFirst.Text, txtLast.Text); //Display data (dataset) dgvResults.DataSource = ds; //point datagrid to dataset dgvResults.DataMember = ds.Tables["Search_Temp"].ToString(); // What table in the dataset? }