Displaying two fields from different databases

I am creating a simple Vacation Management application that requires user management.

To do this, I used the ASP.NET configuration tool and created roles, users, and permissions. The database ASPNETDB.mdf

was created in App_Code

. I then created a few pages .aspx, such as login.aspx

, register.aspx

, changepassword.aspx

, displayinfo.aspx

etc. I have placed the required input controls on each page. In displayinfo.aspx

(after user login.aspx) I placed a control LoginName

that displays a message like "Welcome LoginNameControl (UserName)". Then I created another database called "LMS" to store employee information, which has tables like employee, dept, LeaveType, LeavePolicy, etc.

Now my question is when the user is authenticated, how do I map EmployeeID

from the table Employee

to display.aspx

together with UserName

which is not related to the database ASPNETDB.mdf

?

I am guessing it can be achieved with datarelation a concept DataSet

, but I have no idea how. Can anyone provide me with clear guidelines with correct code? I am not sure when to use the ASP.NET configuration tool or if it is the right choice in this case.

0


a source to share


2 answers


If both databases are on the same instance, you can do something like this:

select database1.table1.column1, database2.table2.column2



Unless you must have some DAL and write code for it using DAL conventions

0


a source


Now my question is to display the EmployeeID of an employee table in display.aspx along with a UserName that is not related to the database "ASPNETDB.mdf".

You don't need to create a separate aspnetdb.mdf, which you can do, just just run the asp_regsql command against your own database, then all tables / views / stored procedures will be created for you to use the assembly - in the aspnet security / membership function. Then you can easily create a foreign key relationship between different tables (your own table and aspnet table).



NTN.

0


a source







All Articles