?
Solved

C# How to databind of Gridview

Posted on 2012-08-10
6
Medium Priority
?
579 Views
Last Modified: 2012-08-11
Hi,
I am new and trying to display data through gridview on web page. My codes are as follows:

gridview
error:

Error
Please help, what I am doing wrong?
Rgds.
Mehram
0
Comment
Question by:Mehram
6 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 38282287
You need to execute reader into a datatable and then from there set the datasource of the datagrid to the datatable.

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/567378e6-5b60-4383-8f1e-666361ab495e/
0
 

Author Comment

by:Mehram
ID: 38282312
can you please correct my code. It help me to understand
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38282359
Is it possible to show your SQL query?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mehram
ID: 38282365
Select sno=Row_number() Over (Order by InvNo,Date), Date, InvNo, Amt=Sum(Amt), CoCom=Sum(Isnull(CoCom,0)), MkCom=Sum(Isnull(MkCom,0)), NPV=Sum(NetPurchasedValue), FreeStock from tempp Group by Date, InvNo, FreeStock Order by InvNo,Date
0
 
LVL 20

Accepted Solution

by:
informaniac earned 2000 total points
ID: 38282954
It is throwing an SQL Exception, that indicates there is something wrong with the query.

Try executing the SQL query in SQL Server and see what are the column names you are getting.
0
 

Author Comment

by:Mehram
ID: 38283238
Sir, please see below result of query:-

query result
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Integration Management Part 2
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question