Click here to Skip to main content
15,303,151 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

Below is my code for

DataSet ds = new DataSet();
       string selectSql = "Items.Description, Items.ItemNo, Items.Qty FROM Items INNER JOIN  ItemParent ON Items.DoNumber = ItemParent.DoNumber";
       string connectionString = ConfigurationManager.ConnectionStrings["InvoiceConnectionString"].ConnectionString;
       SqlConnection conn = new SqlConnection(connectionString);
       SqlDataAdapter da = new SqlDataAdapter(selectSql,conn);
       PrintGv.DataSource = ds.Tables["Items"];

i am getting error near da.Fill(ds,"Items"); as "Incorrect syntax near ','."

could you please help


Where is SELECT in SQL Query. Make your SQL Query proper.
Comments 29-Nov-11 5:15am
thanks prasad
[no name] 29-Nov-11 5:17am
My 5.
Uday P.Singh 29-Nov-11 5:19am
5ed :)
Use "Select"

string selectSql = "Select * from login";
//continue ur code

<a href="">Refer Sql Queries</a>
[no name] 29-Nov-11 5:17am
My 5.
Uday P.Singh 29-Nov-11 5:19am
5ed :)
As the answer is already given, but I recommend This [^]article to get better understanding of best practices.

hope it will help you in future. :)
[no name] 29-Nov-11 5:24am
My 5.
Uday P.Singh 29-Nov-11 5:27am
thanks RaisKazi :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900