List of DB drivers.

J

Jason Keats

Arne said:
Hopefully not.

That code sucks big time.

It's old code written for educational purposes and probably for ADO.NET
1.1 - which did not have DbProviderFactory.

The author is/was an MVP with several books to his name. Are you saying
he can't code? ;-)
 
M

Mr. X.

Thanks ...
As your example, I did :
DbProviderFactory dbf =
DbProviderFactories.GetFactory("MySQL.Data.MySQLClient");

But the above throws an exception :
Unable to find the requested .Net Framework Data Provider. It may not be
installed.
Why is the above exception?

Thanks :)
 
M

Mr. X.

Sorry. Problem solved.
The provider name is case sensitive.
Changed to :
MySql.Data.MySqlClient
Works !!!

Thanks, anyway :)
 
A

Arne Vajhøj


Yes.

"ADO.NET Driver for MySQL (Connector/NET)"
Also, is the provider I pass to DbProviderFactory the same name as the
files included :
I.e for mysql : "MySql.Data" ?
How can I know the exact provider name I pass to DbProviderFactory?

Thee argument is the invariant attribute in the entry
in DbProviderFactories in the config file.

Usually it is the same as the namespace of the provider.

Arne
 
A

Arne Vajhøj

It's old code written for educational purposes and probably for ADO.NET
1.1 - which did not have DbProviderFactory.

1) the article is dated 2 years after .NET with DbProviderFactory
was released

2) even in .NET 1.x the code was crap, because:
- IDbConnection CreateCommand already existed
- the IDbConnection could be constructed using reflection

3) especially for educational purposes things should be done
the right way
The author is/was an MVP with several books to his name. Are you saying
he can't code? ;-)

Apparently he is clueless about how to write database independent
code in .NET and even from a pure OO perspective the code does not
look good (an important aspect of good OO is putting characteristics
in the types and utilizing polymorphism and avoid switch on type).

He may be an excellent ASP/VBS programmer. I have no idea of
knowing.

Arne
 
A

Arne Vajhøj

Sorry. Problem solved.
The provider name is case sensitive.
Changed to :
MySql.Data.MySqlClient
Works !!!

That should not surprise a C# programmer.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top