We help IT Professionals succeed at work.

Bind resultset f/SP gridview

365 Views
Last Modified: 2014-05-26
I am attempting to bind the resultset of a stored procedure to a GridView in ASP.NET. However, the resultset does not appear to be binding. I've stepped through my code and everything looks to be working just fine: my connection isn't getting lost and my parameters are passing through fine. I'm not even getting an error message! I'm just not getting a result set returned.  When I add a breakpoint and inspect the dataset object in the debugger, it is empty.

I have run the stored procedure in SSMS and have verified that I SHOULD be getting a result set returned. Below are my stored procedure and some of the code from my app.

Please tell me what I am doing wrong. Thanks.
HelpWithSPandGridView-ASP.txt
HelpWithSPandGridView-SP.txt
HelpWithSPandGridView-VB.txt
Comment
Watch Question

Daniel Van Der WerkenIndependent Consultant
CERTIFIED EXPERT

Commented:
I think, since you have AutoGenerateColumns = false, that you need to manage the event OnRowDataBount() yourself:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-3

You could try setting this value to "true" and then see if you get columns created with rows populated. After that, create this event in the code and work with it to assign the column values per row as described in the MSDN article.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Once we took out the wildcard we got data from our Stored Procedure.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.