Similar Threads:
1.Provider-independent data access, again
I'm still trying to provide my application (ADO.NET 2.0) with a generic data
access layer, independent of the specific provider used.
Now, my main concern is about connection strings, which can be quite
different amongst various providers.
Imagine I have read some parameters from a configuration file, like the
database type and some connection informations, which every data provider in
the world will definitely supports: hostname, database name, username and
password. I'm purposely avoiding Windows authentication here, since only SQL
Server (and maybe Oracle) supports it.
Ok, I'm creating my provider factory with some code:
-----
Enum DBType
{
SQLServer,
Oracle,
MySQL
}; // So you know what "type" is :-)
DbProviderFactory factory = null;
switch(type)
{
case DBType.SQLServer:
factory = DbProviderFactories.GetFactory("System.Data.SqlClient");
break;
case DBType.Oracle:
factory =
DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
break;
case DBType.MySQL:
factory = DbProviderFactories.GetFactory("MySql.Data.MySqlClient");
break;
default:
throw new NotImplementedException;
}
DbConnectionStringBuilder csb = factory.CreateConnectionStringBuilder();
-----
Ok, now what?
The generic DbConnectionStringbuilder is *so* abstract it only lets you add
generic key-value pairs; you can't even set the data source name or the
username, even if any provider has these parameters!
So, here we go again: the whole provider-independent data model of ADO.NET
2.0 isn't so provider-independent at all.
How to solve this without manually specifying the connection string, which I
don't know and actually don't want to care about? What I want is my
application to read the hostname, the database name, the username and the
password from a configuration file, not some f***ing connection string.
I'm also forced to use the factory model, otherwise I'll have to manually
configure the specific data provider in my db-abstraction class, which I can
surely do, but then the program won't start (or even compile!) if it
references Mysql.Data.MySqlClient and that software isn't installed on the
destination system.
Can someone please help?
Thanks
Massimo
2.Data Adapter Configuration Wizard - Data Connection fails
I can drag any table from server explorer to a form and get a new
SqlConnection and Adapter. I can also perform "Generate DataSet" and
"Preview data". However - configuring the adapter using the Data Adapter
Configuration Wizard fails in the second screen "Choose your data
connection" with error "An unexpected error has occured. Error message:
Object reference not set to an instance of an object. Call stack: at
Microsoft.VSDesigner.Data.VS.VsConnectionManager.CheckConnection(......)"
Not using the wizard I am able to make my programs run. The wizard worked
fine for the first weeks/months. I am mostly connecting to a local MSDE
(sp3) using VS.NET2003 EnterpriseArcitect on Win XpPro(sp2).
Any ideas ?
Erik.
3.Data Adapter Configuration Wizard creates new Connection
Hi
I'm working on a project with multiple developers in VB.NET 2003. SQL
Database
We are mainly connecting to the database by dropping SQL Data Adapter
objects on a form, configuring it and generating a dataset. The Data Adapter
wizard creates a connection object on the form as well. Great.
The problem comes in when one developer has created these objects on a form,
and then another developer goes in a re-runs the Data Adapter wizard (to add
a field to the query for example). The wizard then adds another connection
object to the form because it can't find the existing one (because the
workstation ID is different, because of the different developer). Is there a
better way to do this so we don't have these extra connections being created
when we don't want to? This is creating a lot of hassle.
Thanks
4.Server Explorer - Add Data Connection - Add new Data Provider to l
Does anyone know how to add a new data provider to Visual Studio - to the
Provider list in Server Explorer. I am using Sybase's ADO.NET Data Provider.
It has been added to my GAC and appears in my References.
However, I would like to add the provider to the Provider list in Server
Explorer. Thanks.
~Marsha
5.Typed DataSet with independent data provider?
Hello
I have a project (class library) for data layer of my solution that uses
Typed DataSet.
I want the Typed DataSet to be independent of the data provider.
Is it possible to use Typed DataSet while the data provider is identified in
app.config or web.config?
Regards
Hamed
6. Data Provider independent code
7. SQLSummit .NET data provider list (other data access middleware lists)
8. Oracle Data Provider for .NET: Data provider internal error(-3000)