Forum
 
ForumForumDiscussions and...Discussions and....Net framework ....Net framework ...Why does my SqlDataSource NOT return any data?Why does my SqlDataSource NOT return any data?
Previous Previous
 
Next Next
New Post
 13/03/2009 06:03
 

I wasted an ENTIRE afternoon yesterday NOT getting an SqlDataSource to work. Finally found it this morning.

If you have an SqlParameters collection in the markup AND you add them in the Page_Load then it happily accepts the situation with no error.

Give the parameters values in the Selecting Event – still happy. Just never goes to the database. You can see nothing happening in the Sql Server Trace.

After you have pulled all your hair out you notice the CancelSelectOnNullParameter. Even though you know it has nothing to do with your case you flip it just in case. At last you see it go to the database with each parameter appearing TWICE, once with a value and once with a null. Finally gets you on track to solve it.

Add the parameters in the markup, or add them in code NEVER DO BOTH.


Cheers,
- Richard
If this post helped you over a problem, or taught you something new, please login and rate it. Ratings are in the drop down in the top left corner
Previous Previous
 
Next Next
ForumForumDiscussions and...Discussions and....Net framework ....Net framework ...Why does my SqlDataSource NOT return any data?Why does my SqlDataSource NOT return any data?

Forum Usage Guidelines

The forums are a place for all to exchange ideas and techniques, and to post and answer questions.  All are welcome to read, registration is required to post. 

If you learn somthing new, discover or acquire a new technique, then please take a moment to register and rate the post that just helped you.  This site does not send spam and it does not release your personal details.  Full details in the site privacy policy.

We have some simple posting guidelines to keep the forums a pleasant and informative environment.

  • No flames, no trolls
  • No profanity, no racism
  • Site management has the final word on approving or removing any thread, post, or comment
  • English language only please

 

Copyright 2002-15 by Dynamisys Ltd