private void LoadCustomers() { ClsSqlConnection obj = new ClsSqlConnection(); GridCustomers.DataSource = obj.getCustomers(); GridCustomers.DataBind(); }
private void LoadCustomer() { ClsSqlConnection obj = new ClsSqlConnection(); DataSet objDS = obj.getCustomers(); dataGridView1.DataSource = objDS.Tables[0]; }
private void displayCustomer(string CustomerCode) { ClsSqlConnection obj = new ClsSqlConnection(); DataSet objDataSet = obj.getCustomers(CustomerCode); string objCustName = objDataSet.Tables[0].Rows[0][0].ToString(); string objCustCountry = objDataSet.Tables[0].Rows[0][1].ToString(); string objGender = objDataSet.Tables[0].Rows[0][2].ToString(); string objHobby = objDataSet.Tables[0].Rows[0][3].ToString(); bool Married = false; if (objDataSet.Tables[0].Rows[0][4] != DBNull.Value) { Married = Convert.ToBoolean(objDataSet.Tables[0].Rows[0][4].ToString()); } txtCstmrName.Text = objCustName; cBoxCountry.Text = objCustCountry; if ((objGender.Length == 0) || (objGender.Trim() == "Male")) { rbtnMale.Checked = true; } else { rbtnFemale.Checked = true; } if (objHobby.Trim() == "Reading") { chkbxReading.Checked = true; chkbxPainting.Checked = false; } else { chkbxPainting.Checked = true; chkbxReading.Checked = false; } if (Married) { rbtnMarried.Checked = true; } else { rbtnSingle.Checked = true; } }
private void btnSearch_Click(object sender, EventArgs e) { CommonCode obj = new CommonCode(); if (obj.Validate(txtCustomerName.Text) == false) { MessageBox.Show("Customer name is compulsory"); return; } ClsSqlConnection obj1 = new ClsSqlConnection(); DataSet objDS = obj1.getCustomers(txtCustomerName.Text); dataGridView1.DataSource = objDS.Tables[0]; }