Hi everyone
I have a problem with comma separated string. I have a database vendor detail which is as follows.
ID Vendor_Name Asset_Type
37 Futuresoft Motherboard,SMPS,
38 Future India HDD,joystick,Laptop Screen,
39 Tech_M Baterry,Laptop Screen,Mouse,
46 dgd Battery,
47 Religare HDD,joystick,Mouse,Processor,RAM,
48 ryy Battery,HDD,joystick,
I have a text box TextBox8 that contain Battery,Mouse. So i need to selcet the Vendor Name and bind it to a dropdownlist from Vendor detail that contains both Battery,Mouse present in TextBox. How to do it Please help.
My code is as follows
public void bindddl()
{
{
string qry = "SELECT DISTINCT Vendor_Name FROM [VandorDetail] WHERE Asset_Type in ("+TextBox8.Text+"') ";
SqlDataAdapter adpt = new SqlDataAdapter(qry, con);
DataTable dt = new DataTable();
adpt.Fill(dt);
DropDownList4.DataSource = dt;
DropDownList4.DataBind();
DropDownList4.DataTextField = "Vendor_Name";
DropDownList4.DataValueField = "Vendor_Name";
con.Close();
}
}