Thursday, December 3, 2009
SqlDataAdapter.Fill Empty When I Know It Shouldn't Be
I ran into a very odd issue using SqlDataAdapter.Fill. I could run my dynamically generated SQL query with no parameters and it would be fine. As soon as I added parameters, it would not fill the DataTable with records. After a lot of debugging and profiling I realized when I added parameters the command was being executed using exec sp_executesql instead of just straight T-SQL. So I copied the exec sp_executesql command from profiler and ran it manually and got the results I was expecting so the data was coming back. On a hunch, based on comparing a similar function that has never failed me, I decided the only thing really different was that I did not specify a table name when declaring my DataTable object (e.g. var dt = new DataTable("TableName");). As soon as I added a name, it worked! I have no idea why. Someday I would love too know, but I already spent hours figuring it out today. If anyone knows, I'd love to hear it but for now I guess the lesson is just always give your DataTable instances a name.
Labels:
.NET,
Programming,
SQL,
SqlDataAdapter
Thursday, November 12, 2009
.NET 2.0+ FTP Client Library
I've created a free and easy to use FTP client library for .NET 2.0+
Download Here
I only ask that if you use this library in a profitable production environment that you please donate. Users that donate $50 or more will receive the source code upon request.
Download Here
I only ask that if you use this library in a profitable production environment that you please donate. Users that donate $50 or more will receive the source code upon request.
Labels:
Free,
FTP,
Programming,
Software Libraries
Saturday, September 19, 2009
Subscribe to:
Posts (Atom)