Geeks With Blogs
Mark Pearl

 

I have recently been using NDbUnit for integration tests exercising the database. I am new to the tool, so the following exception caused a few hours of scratching my head before I figured out the obvious.

Assume you are going through the quick start guide from the website, everything works perfectly. Then I changed to my production database and did the same thing and I get the following error…]

DbCommandBuilder.CreateSelectCommand(DataSet, string) failed for tableName = '….

Turns out the name of the table in my database was “My.ExampleTable” with the “My” being part of a schema and the . was causing the headache. This is because when I was adding the table from the .NET Dataset in my project, it was removing the . from the table name automatically.

The way you can identify this is if you go into Sql Management Studio and look at the Schemas.

Schema

Pulling the table into the xsd diagram will give you something like the following…

2

Adding the first part of the name back to the xsd diagram file solved the problem as illustrated in the last diagram….

3

And that should resolve the error, or at east it did in my case…

Posted on Friday, December 9, 2011 2:05 PM C# , Misc | Back to top


Comments on this post: Fix for NDbUnit - DbCommandBuilder.CreateSelectCommand(DataSet, string) failed for tableName = 'XXX'

# re: Fix for NDbUnit - DbCommandBuilder.CreateSelectCommand(DataSet, string) failed for tableName = 'XXX'
Requesting Gravatar...
Glad you were able to resolve this issue for yourself. Strictly-speaking this is a problem with how the Visual Studio dataset designer handles (or more accurately, *fails* to handle) tables in different schemas in re: the way it represents table names. Fortunately you were able to deduce the straightforward tweak needed to work around this. Thanks for taking the time to post blog about your discovery!
Left by Steve Bohlen on Dec 10, 2011 2:26 PM

# re: Fix for NDbUnit - DbCommandBuilder.CreateSelectCommand(DataSet, string) failed for tableName = 'XXX'
Requesting Gravatar...
Thanks! I'm new to NDBunit as well, and this post has saved me a lot of time
Left by Lucia on Jun 09, 2014 1:04 PM

Your comment:
 (will show your gravatar)


Copyright © MarkPearl | Powered by: GeeksWithBlogs.net