///////////////////////////// string commaDelimited = textBox1.Text; string[] year = commaDelimited.Split(new char[] { }); ///////////////////////////////////////// //string[] r = { "TV", "Radio", "Coal" }; string filter = string.Empty; foreach (string name in year) { if (filter.Length > 0) { filter += ","; } filter += string.Format("'{0}'", name); } SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=ERPDB;Integrated Security=True"); SqlDataAdapter adp; DataSet ds = new DataSet(); adp = new SqlDataAdapter("Select * from Prod_Tbl where ProductName IN (" + filter + ")", con); adp.Fill(ds, "Prod_Tbl"); dataGridView1.DataSource = ds.Tables[0].DefaultView;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)