Sunday, March 25, 2012

Combining databases

Dear Developres,

Actually I'm on the half way of making a portal and I get some problem I need your kindly helps.

at first I use the membership feature of ASP.net 2.0 to have login and all so by default it has generate an ASPNETDB.MDF file which its is (Microsoft SQL Server Database File (SqlClient)) and also I have two more databases one for file managemnet and one for Calander and Contacts but I need all to be one so whenevr one user can login it can show his own file in his page but now everyone can see all,Can anybody guide me should it all be in one database and if yes how can I connect all since one is generated by default by Visual studio2005.Should I use a Microsoft SQL Server (SqlClient)?

Thanks in advance.

Hi,

I think the problem is something related to membership expanding. Actually you can add your datatables into ASPNETDB.mdf and in each table , create a primary key (such as UserId or something like that ) which is the foreign key of the aspnet_users. And then, create a view so when the user login, he can get all his files.

Thanks.

|||

Hello Michael,

Thanks for you reply ,actually I have done the same thing but in one file that has stored procedure got problem ad it says:

Cannot insert the value NULL into column 'DateCreated', table ASPNETDB.MDF.dbo.Files'; column does not allow nulls. INSERT fails.
The statement has been terminated.

Can you please tell me whats the problem?

|||

Hi,

The DateCreated field in your database doesn't allow nulls so when you insert the record, don't forget to insert the datacreated value, you can use Date.Now to get the current time.

Thanks.

|||

Actually the error is for something else I dont know why because by the time that it was outside the ASPNET.MDF it works well but as I move inside the new databse it has this error.

Thanks

Bye

|||

Hi,

Try to check if allow-null is checked and generally that is caused by the restraint in your database.

Thanks.

No comments:

Post a Comment