Incorrect syntax near ','.

don420

New member
Joined
Jun 20, 2011
Messages
2
Programming Experience
3-5
cmd = New SqlClient.SqlCommand("select(pname,MRP,rate,dis) from stock_table where pid = '" & Val(ComboBox1.Text) & "'", con)
adapter.SelectCommand = cmd
adapter.Fill(ds1)
i am getting the error in the last line ..
plzzz help
thanks in advance
 
Remove the brackets from your Select fields.

VB.NET:
Expand Collapse Copy
cmd = New SqlClient.SqlCommand("select(pname,MRP,rate,dis) from stock_table where pid = '" & Val(ComboBox1.Text) & "'", con)

should be....

VB.NET:
Expand Collapse Copy
cmd = New SqlClient.SqlCommand("select pname,MRP,rate,dis from stock_table where pid = '" & Val(ComboBox1.Text) & "'", con)
 
Back
Top