473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

SQL server and Access SELECT in one Query

How do I create one SELECT query in VB .NET that pulls from a SQL Server
database and a MS Access database? The SQL server table has a unique
identifier as a PK and the Access table has a autonumber (replication ID) as
a FK, which matches the SQL table PK, so I know I can join them on this field.

Currently, I am using SQLCommand to access only the SQL server data and DAO
to access only the MS Access data. Is there a way to create a
SQLConnectionString that points to multiple DBs?

What is the best approach?

Thanks,

Tom
Dec 4 '06 #1
5 1799
Tomh,

If you ask this in the newsgroup

microsoft.public.dotnet.framework.adonet

Than you have much more change on an answer on this particular question.

Cor

"TomH" <To**@discussions.microsoft.comschreef in bericht
news:18**********************************@microsof t.com...
How do I create one SELECT query in VB .NET that pulls from a SQL Server
database and a MS Access database? The SQL server table has a unique
identifier as a PK and the Access table has a autonumber (replication ID)
as
a FK, which matches the SQL table PK, so I know I can join them on this
field.

Currently, I am using SQLCommand to access only the SQL server data and
DAO
to access only the MS Access data. Is there a way to create a
SQLConnectionString that points to multiple DBs?

What is the best approach?

Thanks,

Tom

Dec 4 '06 #2
Why use DAO? It's so old I can't even remember the syntax any more...

Maybe your question hides specific details that mean you are limited to
existing code or something... if not use ADO.Net and save a lot of hassle.

You could fill one table in a dataset with a sqldataadapter, and another
with the oledbadapter (for Access), and also define your relationship in the
dataset between the two tables, exactly as you described plus with the
options of referential integrity checking, cascaded deletes, updates etc
etc. That's what it's for isn't it?

Cheers


"TomH" <To**@discussions.microsoft.comwrote in message
news:18**********************************@microsof t.com...
How do I create one SELECT query in VB .NET that pulls from a SQL Server
database and a MS Access database? The SQL server table has a unique
identifier as a PK and the Access table has a autonumber (replication ID)
as
a FK, which matches the SQL table PK, so I know I can join them on this
field.

Currently, I am using SQLCommand to access only the SQL server data and
DAO
to access only the MS Access data. Is there a way to create a
SQLConnectionString that points to multiple DBs?

What is the best approach?

Thanks,

Tom

Dec 4 '06 #3
I don't know of any way that you can open two databases with the
same connection. Why do you want to? Is there another solution
to resolve what you're trying to accomplish?

The only thing I can think of is you could add linked tables to your
Access database that access the SQLServer database tables you're
interested in, and then you could query those tables and your pure
Access tables together.

Robin S.
-------------------------------------------
"TomH" <To**@discussions.microsoft.comwrote in message
news:18**********************************@microsof t.com...
How do I create one SELECT query in VB .NET that pulls from a SQL Server
database and a MS Access database? The SQL server table has a unique
identifier as a PK and the Access table has a autonumber (replication ID)
as
a FK, which matches the SQL table PK, so I know I can join them on this
field.

Currently, I am using SQLCommand to access only the SQL server data and
DAO
to access only the MS Access data. Is there a way to create a
SQLConnectionString that points to multiple DBs?

What is the best approach?

Thanks,

Tom

Dec 4 '06 #4

http://www.sqlservercentral.com/colu...kingtables.asp

regards

Michel Posseth

"TomH" wrote:
How do I create one SELECT query in VB .NET that pulls from a SQL Server
database and a MS Access database? The SQL server table has a unique
identifier as a PK and the Access table has a autonumber (replication ID) as
a FK, which matches the SQL table PK, so I know I can join them on this field.

Currently, I am using SQLCommand to access only the SQL server data and DAO
to access only the MS Access data. Is there a way to create a
SQLConnectionString that points to multiple DBs?

What is the best approach?

Thanks,

Tom
Dec 4 '06 #5
On Sun, 3 Dec 2006 20:26:00 -0800, TomH wrote:
How do I create one SELECT query in VB .NET that pulls from a SQL Server
database and a MS Access database? The SQL server table has a unique
identifier as a PK and the Access table has a autonumber (replication ID) as
a FK, which matches the SQL table PK, so I know I can join them on this field.

Currently, I am using SQLCommand to access only the SQL server data and DAO
to access only the MS Access data. Is there a way to create a
SQLConnectionString that points to multiple DBs?

What is the best approach?

Thanks,

Tom
I believe in SQL server you can create a linked server to access the access
database
--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
9
by: wiredog | last post by:
I am struggling rewriting my query from MS Access' IIF, Then to SQL Servers TSQL language. I am hoping some one can give me some guidance. I believe I have the first portion of the query correct...
2
by: Amanda | last post by:
From a guy in Microsoft newsgroups: | In *comp.databases.ibm-db2* there are always IBM guys | from the Toronto labs on line.Post with the | -for the love of god please help- | line...
15
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? ...
6
by: lesperancer | last post by:
SELECT distinct b.t_orno, b.t_pono FROM tblMonthlyBooking AS b, tblFilterDate, tblFilterDate AS tblFilterDate_1 WHERE (((b.t_yearMonth) Between . And .)); tblMonthlyBooking is a sql server...
8
by: s_wadhwa | last post by:
SELECT DISTINCTROW "01C" AS dummy, Buildings.BuildingNumber, UCASE(Buildings.BuildingName) AS BuildingName, Buildings.MasterPlanCode, Buildings.UniformBuildingCode,...
9
by: billmiami2 | last post by:
I was playing around with the new SQL 2005 CLR functionality and remembered this discussion that I had with Erland Sommarskog concerning performance of scalar UDFs some time ago (See "Calling...
10
by: tlyczko | last post by:
Hello, We have Access databases (backends) that will eventually be consolidated into a SQL Server database, to facilitate data reporting, analysis, etc. Some queries in one Access database...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.