Groups | Blog | Home
all groups > vb.net data > april 2004 >

vb.net data : Acessing two database files......


Wayne Taylor
4/19/2004 6:09:18 PM
Hello All

I'm new to the world of database and T-SQL......I'm using VB.NET (I hope I'm
in the right place)......

The client has accessing control in there building. I have looked at the
software and it writes it's data to access databases.

There are two files seprate database files, I can query either of them and
get the information I want. The client would like when doors are accessed an
e-mail is sent to selected recepites, detailing who entered what door with
the time and date.

The problem I have is the main database called system only holds archieved
accesses, but has the users table in it.

The other database called events has the live events, ie when some one goes
through a door it's this database and it's table called events that get's
updated.

Looking at a copy of the database there is a link from the system database
to the events datebase.

What I don't know how to do is write the T-SQL to query each and join them
together so I end up with a results table of recents events with
usernames.....

I hope that makes sense, if not please e-mail me. (Remove online form my
e-mail address)

Thanks in advance

Wayne Taylor




Gerry O'Brien [MVP]
4/21/2004 9:56:49 AM
You can simply query the two DBs seperately if you want.

There must be a key such as a userID or card number that is related to a
user.

You can retrieve the access ID first from the access panel DB or wherever it
comes from, then, using that value, pass it to the next SQL statement as the
ID to select records from the second table.

Example;

If a card is swiped at a reader and you get the card ID of 12345, then you
can create an SQL statement such as this;

SELECT username FROM usertable WHERE UserID = 12345.

Replace username, usertable and UserID with the appropriate field names from
the user DB and you are all set.


--
Gerry O'Brien
Visual Developer .NET MVP
Visual Basic


[quoted text, click to view]

AddThis Social Bookmark Button