Why doesn't the Visual Studio TableAdapter query return the same data as the stored procedure it represents?
I am using a table adapter in Visual Studio to query a stored procedure in my SQL Server 2005 database. When I make a call through my website application, it returns nothing. When I make the same call through SQL Server Manager, it returns the expected data.
I put a breakpoint on the adapter call getData
and looked at all the parameters and their values ββand matched them in the request from server control to be sure. I am sending the following request:
getData(string, date, date, int, int?, int?, string, int?, string)
Further
getData('0000-rtg', '1/1/2007', '3/12/2008', 0, null, null, null, null, null)
I think I'm wondering what Visual Studio is doing something with null
before it tries to send a query to the SQL server. If not, how can I solve this problem?
EDIT: All these values ββare passed in by variables, I just typed what was in those variables at that breakpoint.
source to share
Visual Studio can be funny with query parameters. Make sure each variable is of the correct length and type. For example, I am using multiple date parameters in a query. Every time I edit the query, Visual Studio automatically detects the date parameters and limits the variable to length 7. I pass the date as "12/9/2009" which is disabled until "9/12/20" so I need to manually change the parameters dates to a length of 10.