private void btnSearch_Click(object sender, EventArgs e) { clsSqlServer objSql = new clsSqlServer(); DataSet objDataset = objSql.getCustomers(); datagridSearch.DataSource = objDataset.Tables[0]; }
private void loadCustomers() { clsSqlServer custObj = new clsSqlServer(); GridCustomers.DataSource = custObj.getCustomers(); // DATA SOURCE set GridCustomers.DataBind(); // bind data to grid }
private void LoadCustomers() { clsSqlServer obj = new clsSqlServer(); DataSet objDataset = obj.getCustomers(); //bind the data to the UI dtgCustomers.DataSource = objDataset.Tables[0]; }
private void DisplayCustomer(string CustomerCode) { clsSqlServer obj = new clsSqlServer(); DataSet objDataset = obj.getCustomers(CustomerCode); //Select the records and display it on the screen string strCustomerName = objDataset.Tables[0].Rows[0][0].ToString(); string strCountryName = objDataset.Tables[0].Rows[0][1].ToString(); string strgender = objDataset.Tables[0].Rows[0][2].ToString(); string strhobbies = 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]); } txtCustomerName.Text = strCustomerName; cboCountry.Text = strCountryName; if ((strgender.Length == 0) || (strgender == "Male")) { rdoMale.Checked = true; } else { rdoFemale.Checked = true; } //hoobies boolean if ((strhobbies.Length == 0) || (strgender == "Sports")) { chkReading.Checked = true; } else { chkSports.Checked = true; } //status boolean if (Married) { rdoMarried.Checked = true; } else { rdoUnmarried.Checked = true; } }
private void displayCustomer(string custname) { clsSqlServer custObj = new clsSqlServer(); DataSet objDataset = custObj.getCustomers(custname); // Select the records and display it on the screen string strCustomerName = objDataset.Tables[0].Rows[0][0].ToString(); string strCountryName = objDataset.Tables[0].Rows[0][1].ToString(); string strGenderName = objDataset.Tables[0].Rows[0][2].ToString(); string strHobbiesName = objDataset.Tables[0].Rows[0][3].ToString(); string strEmail = objDataset.Tables[0].Rows[0][4].ToString(); bool StatusName = false; if (objDataset.Tables[0].Rows[0][5] != DBNull.Value) // use bdnull instead of null when we use ado.net, dataset { StatusName = Convert.ToBoolean(objDataset.Tables[0].Rows[0][5].ToString()); } txtCustomerName.Text = strCustomerName; ddlCountries.Text = strCountryName; txtEmail.Text = strEmail; // Gender //string strGenderName = objDataset.Tables[0].Rows[0][2].ToString(); if (strGenderName == "Male") { male.Checked = true; } else { Female.Checked = true; } // Hobbies if (strHobbiesName == "Reading") { Reading.Checked = true; } else { Painting.Checked = true; } // Married if (StatusName) { Married.Checked = true; } else { Unmarried.Checked = true; } // Close the connection //objConnection.Close(); }
public DataSet getCustomers() { clsSqlServer obj = new clsSqlServer(); return(obj.getCustomers()); }
public DataSet LoadCustomer(string CustomerName) { clsSqlServer obj = new clsSqlServer(); return(obj.getCustomers(CustomerName)); }