"GregG" <Gr***@electron.comwrote in message
news:d1********************************@4ax.com...
In Access, however, you can link external tables from innumerable foreign
databases into the current database and perform heterogeneous queries
Yes you can, but you don't *have* to... You can include tables from more
than one Jet database in the same query without actually having to actually
create linked tables i.e. your current collection of Jet database could stay
as they are without modification...
The new implementation of OLEDB which comes with .NET still uses a
connection string, stored in Web.config,
For the record, the connection string doesn't *have* to be stored in
web.config...
it's there, same as before. But it now includes a strong-typing layer
above that, and the ability to create predefined Get, Set, Fill
methods to make vastly different data models appear the same to the
BLL and ultimately the application layer. These definitions are
contained in the .XSD files, which are in XML format.
Yes, it creates the *ability* to do those things that you mention, but
doesn't *force* you to do any of them...
But! I can find no mechanism for connecting these disparate tables
into a homogenous unit in ASP.NET. I believe it was designed to
primarily integrate with SQLServer - which is admittedly a superior,
scalable solution.
OK, here's a method from my DAL which will return a DataSet given an OleDb
connection string and a piece of SQL:
using System.Data;
using System.Data.OleDb;
public abstract class COleDb
{
public static DataSet GetDataSet(string pstrConnectionString, string
pstrSQL)
{
try
{
using (OleDbConnection objOleDbConnection = new
OleDbConnection(pstrConnectionString))
{
objOleDbConnection.Open();
using (OleDbCommand objOleDbCommand = new
OleDbCommand(pstrSQL, objOleDbConnection))
{
using (OleDbDataAdapter objDA = new
OleDbDataAdapter(objOleDbCommand))
{
using (DataSet objDataSet = new DataSet())
{
objDA.Fill(objDataSet);
objOleDbConnection.Close();
return (objDataSet);
}
}
}
}
}
catch (OleDbException ex)
{
throw ex;
}
catch (Exception)
{
throw;
}
}
}
Then, supposing you needed to bind a GridView to a DataSet fetched from two
separate Jet databases without creating any linked tables in either of them,
you could do something like this:
string strConnection = ".......";
string strSQL = "SELECT Customers.* FROM Customers INNER JOIN
[Sales.mdb].Sales ON Customers.CustomerID = Sales.CustomerID"
MyGridView.DataSource = COleDb.GetDataSet(strConnection, strSQL);
MyGridView.DataBind();
--
Mark Rae
ASP.NET MVP
http://www.markrae.net