private void FLoadListBox(string strTagName) { this.listBox1.Items.Clear(); if (this.txtInput.text == "Product") { string strSql = "Select Product from TblSales"; } else { string strSql = "Select Orders from TblSales"; } sqlconn = new SqlConnection(connstr); sqlconn.Open(); SqlDataAdapter DA = new SqlDataAdapter(strSql, sqlconn); System.Data.DataSet DS = new DataSet("DS"); DS.Clear(); DS.Tables.Clear(); DA.Fill(DS, "Display"); if (this.txtInput.text == "Product") { this.listBox1.DisplayMember ="Product"; this.listBox1.DataSource = DS.Tables["Display"]; } else { this.listBox1.DisplayMember ="Orders"; this.listBox1.DataSource = DS.Tables["Display"]; } sqlconn.close(); }
this.listBox1.DataSource = null; this.listBox1.Items.Clear();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)