I am creating desktop application in which i have created a form in which there are
three comboboxes namely cboproduct,cborawmaterial_id and cborawmaterial.
I have
products namely steamiron,mobile,juicer with respective product id.
I have
rawmaterials thermostat,inlay,ic,cuplor,jar,led.
I want that when i select one product at a time from cboproduct,i should get its respective rawmaterials in cborawmaterial.
I created a 2 tables
product_info with field product_id and product
rawmaterial_info with field product_id ,rawmaterial_id and rawmaterial
I tried this coding
private void fillProductId()
{
SqlConnection con;
SqlCommand com;
String message;
con=new SqlConnection(@"Data Source=AKMINDER-PC\SQLEXPRESS;Initial Catalog=elin appliances(Comaker of PHILIPS);Integrated Security=true");
message
= "Select Product_ID, Product from product_info";
con.Open();
DataSet DS = new DataSet();
SqlDataAdapter DA = new SqlDataAdapter();
DA.SelectCommand = new SqlCommand(message, con);
com.ExecuteNonQuery();
DA.Fill(DS);
con.Close();
if (DS.Tables[0].Rows.Count > 0)
{
combo1.DataSource = DS.Tables[0];
combo1.DataTextField = "Product";
combo1.DataValueField = "Product ID";
combo1.DataBind(); combo1.Items.Insert(0, "--Select--");
}
else
{
lblMsg.Text = "No product found";
}
}
error
combo1.DataTextField = "Product";
combo1.DataValueField = "Product ID";
combo1.DataBind();
does not contain a definition for DataTextField ,DataValueField,DataBind and no extension method accepting a first argument of type (are you missing a using directive or an assembly reference?)