{ string query = "Select * from Guaronters where Guarantor_CNIC='" + cbocnic1.Text + "-" + cbocnic2.Text + "-" + cbocnic3.Text + "'"; // MessageBox.Show(query); SqlDataAdapter da = new SqlDataAdapter(query, cn); dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 0) { MessageBox.Show("The CNIC'" + cbocnic1.Text + "-" + cbocnic2.Text + "-" + cbocnic3.Text + "'does not Exists!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cbocnic1.SelectAll(); cbocnic1.Focus(); } else { r = 0; Displayrecord(); } } } } public void Displayrecord() { Guarantor_Search gse = new Guarantor_Search(); gse.txtname.Text = dt.Rows[r]["Name"].ToString(); gse.txtfather.Text = dt.Rows[r]["Father_name"].ToString(); gse.txthusband.Text = dt.Rows[r]["Husband_name"].ToString(); gse.dateTimePicker1.Value = Convert.ToDateTime(dt.Rows[r]["Date_of_Birth"]); gse.txtmarital.Text = dt.Rows[r]["Marital_Status"].ToString(); gse.txtoccupation.Text = dt.Rows[r]["Occupation"].ToString(); gse.txtpostal.Text = dt.Rows[r]["Postal_address"].ToString(); string str; str = dt.Rows[r]["Customer_CNIC"].ToString(); string[] cnic1; cnic1 = str.Split('-'); gse.txtcustomercnic1.Text = cnic1[0]; gse.txtcustomercnic2.Text = cnic1[1]; gse.txtcustomercnic3.Text = cnic1[2]; string str1; str1 = dt.Rows[r]["Mobile"].ToString(); string[] Mobile; Mobile = str1.Split('-'); gse.txtcode.Text = Mobile[0]; gse.txtmobile.Text = Mobile[1]; string str2; str2 = dt.Rows[r]["Guarantor_CNIC"].ToString(); string[] cnic; cnic = str2.Split('-'); gse.txtcnic1.Text = cnic[0]; gse.txtcnic2.Text = cnic[1]; gse.txtcnic3.Text = cnic[2]; if (dt.Rows[r]["Gender"].ToString() == "Male") { gse.rdomale.Checked = true; } else { gse.rdofemale.Checked = true; } gse.Show(); } public void nextrecord() { if (r < dt.Rows.Count - 1) { r = r + 1; Displayrecord(); } else { MessageBox.Show("You are at Last Record"); } }
private void button2_Click(object sender, EventArgs e) { gseup.nextrecord(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)