1110
1110

Reputation: 6839

Users table does not exist

I have made a module that use Users table of DNN.
But today I get wired error that Users table does not exist.
When I looked in database I saw that Users table name is actually dbo_Users.
I thought that DNN Users table always have the same name but it seams it is not.

What is the reason that dnn added that prefix to table (all DNN tables) and how can I know if table has that prefix?

Upvotes: 1

Views: 284

Answers (1)

bdukes
bdukes

Reputation: 155985

DotNetNuke allows setting up a site with an "object qualifier" for the database (as well as a custom schema/database owner). This enables a little better security, and gives the potential to host multiple applications within the same database while avoiding naming conflicts. Neither of those reasons are very good, and few make use of the feature, but you still run into it now and then.

You can use DotNetNuke.Common.Utilities.Config.GetObjectQualifer() to get the object qualifier of the current site.

In any scripts that you run as part of a package's installation, DNN will automatically replace {databaseOwner} and {objectQualifier} tokens with the correct value.

If you use Entity Framework or LINQ to SQL, there are model adapters which have been put together by Brandon Haynes which automatically take these into account.

Upvotes: 3

Related Questions