Hi Everyone

I have used a drop down and a label. I want on the selection of the drop down data should be viewed on label.

ex: if user select value from drop down (Apple) so on label it should print (50 per KG)

Data should come from sqldata and I can't use join because there is no relationship between the two tables. Is there any other suggestion on how I can do this ?

2) i am using data grid view in that i want that user should typed manually address and then click on submit then data should save in sql server

the code i have written is giving me error

SqlConnection con = new SqlConnection(@"Server=NGENIOUS-WSSDEV\SQLEXPRESS;Database=MIC;Trusted_Connection= True");
           con.Open();
           SqlCommand cmd = new SqlCommand("insert into clientwiseproductwise(productcategory,discounttype,scount,Dfactor)values ('" + productcategoryDataGridViewTextBoxColumn + "','" + discounttypeDataGridViewTextBoxColumn + "','" + DiscountValue + "','" + dfactorDataGridViewTextBoxColumn + "')", con);
           
         
            cmd.ExecuteNonQuery();
            con.Close();

            
            
            
            
            MessageBox.Show("Data Successfully Submitted");

if in insert statement i put @productcategory then it is telling me must declare variable

if i remove @
then the error is

String or binary data would be truncated.
The statement has been terminated.

Truncation usually means that there is an attemtp to insert a larger length value into a column.Example "Column= Varchar(4)", when you attempt to insert the following string "ferrari" into that column ,you will get an error because the length has been exceeded by 3 characters...So try increasing the length value of that paticular column on the DB...

This article has been dead for over six months. Start a new discussion instead.