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

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);
       da.Fill(ds,"Items");
       PrintGv.DataSource = ds.Tables["Items"];


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

could you please help

Thanks
Posted

Where is SELECT in SQL Query. Make your SQL Query proper.
   
Comments
Lancy.net 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"

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


<a href="http://www.java2s.com/Code/SQLServer/Select-Query/CatalogSelect-Query.htm">Refer Sql Queries</a>
   
Comments
[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 ADO.net best practices.

hope it will help you in future. :)
   
Comments
[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