i want to create a query which select three columns from a table on certain condition now i have got certain with three columns and i can bind this data to a datagridview but before this i want to add a column to dgv say col_new and fill its cell with a variable value
here's my query
SELECT PID, Name, FName FROM Tbl_Products WHERE PID = '" + PID.ToString()
iwant to do somthing like this
SELECT '"+ Col_New.text +"' PID, Name, FName FROM Tbl_Products WHERE PID = '" + PID.ToString()
and when ill bind my data to dgv then i should get PID Name FName from table and Col_New from variable
Jump to Post
So what issue are you having? Not sure exactly what you mean, but In any case, I would think you are missing a comma (and apostrophe at the end) in your second SQL example..
sqlString = "SELECT '"+ Col_New.text +"', PID, Name, FName FROM Tbl_Products WHERE PID = '" + …
All 3 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.