Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Please help,I've been trying to solve it


Extracting Data from excel sheet using sql query in vb.net.

MyCommand = New System.Data.OleDb.OleDbDataAdapter("select [Imp],sum(Assigned Group='abc')abc from [MAN_Dump$] grouped by [Imp])", MyConnection)
Posted

If you tried to run the query
select [Imp],sum(Assigned Group='abc')abc from [MAN_Dump$] grouped by [Imp])
in Query Analyser/SSMS/Access Query you are going to get all sorts of syntax errors.
You might want something like
select [Imp],sum(Assigned) abc from [MAN_Dump$] group by [Imp]

If you are really using SQL then I suggest using the SqlDataAdapter Class (System.Data.SqlClient)[^] rather than the OleDbDataAdapter Class (System.Data.OleDb)[^] ... either way you will need to get the syntax of the query right
 
Share this answer
 
Incorrect syntax in your SUM function.

SQL SUM() Function[^]


What are you trying to accomplish?
 
Share this answer
 
Comments
PIEBALDconsult 31-Jan-16 10:19am    
That's the "how"; I want to know the "what".
PIEBALDconsult 31-Jan-16 10:29am    
Perhaps you could show a small amount of sample data and what value you want to calculate.

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