[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Kuba Mahdal

1/19/2003 12:05:00 PM

Please help, i have the same problem as mr. Alan G.
Thomson:

I want to connect to a PostgreSQL database from the IDE of
the Visual C# .Net using ODBC. I have downladed the ODBC
driver of PostgreSQL, and ODBC for the .Net framework, and
I can connect between Visual studio and the database, but
I can't do that between a form, and the same database,
using any of the adaptors provided with C#.

my code is:
String MyConnString="Provider=MSDASQL.1;Persist Security
Info=False;Data Source=Postgres_moje;...............
System.Data.OleDb.OleDbConnection con = new
System.Data.OleDb.OleDbConnection(MyConnString);

and there is an error:
An unhandled exception of type 'System.ArgumentException'
occurred in system.data.dll

Additional information: The .Net Data OLE DB Provider
(System.Data.OleDb) does not support
the MSDASQL Provider, Microsoft OLE DB Provider for ODBC
Drivers.

I need help
with this problem as soon as possible please.

1 Answer

Daniel Morgan

1/24/2003 10:03:00 AM

0

For ODBC, you should be using the ODBC.net provider.
For .NET 1.0, it is a download you have to get from
http://msdn.microsoft.com/downloads/sample.asp?url=/msdn-files/027...
sdncompositedoc.xml&frame=true
It has a namespace of Microsoft.Data.Odbc is has an assembly
Microsoft.Data.Odbc.dll

For .NET 1.1, it is included. It has a namespace of System.Data.Odbc and
is included in the System.Data.dll assembly.

If you want to connect to PostgreSQL, did you set up a DSN in ODBC Data
Sources in the control panel to connect to PostgreSQL?

By the way, have you use Npgsql? It is a Managed .NET Data Provider for
PostgreSQL written in 100% C# and does not require a client library.
http://gborg.postgresql.org/project/npgsql/projd...

Also, the Mono Project (the .net framework/C# for UNIX) has a PostgreSQL
provider; however, it will be replaced with Npgsql in the future. It
requires the PostgreSQL client library to work (pq.dll on Windows and
libpq.so on Linux)..
http://www.go-mono.com/postg...

"Kuba Mahdal" <plymo@email.cz> wrote in message
news:033601c2bfaa$b45ffbd0$d5f82ecf@TK2MSFTNGXA12...
> Please help, i have the same problem as mr. Alan G.
> Thomson:
>
> I want to connect to a PostgreSQL database from the IDE of
> the Visual C# .Net using ODBC. I have downladed the ODBC
> driver of PostgreSQL, and ODBC for the .Net framework, and
> I can connect between Visual studio and the database, but
> I can't do that between a form, and the same database,
> using any of the adaptors provided with C#.
>
> my code is:
> String MyConnString="Provider=MSDASQL.1;Persist Security
> Info=False;Data Source=Postgres_moje;...............
> System.Data.OleDb.OleDbConnection con = new
> System.Data.OleDb.OleDbConnection(MyConnString);
>
> and there is an error:
> An unhandled exception of type 'System.ArgumentException'
> occurred in system.data.dll
>
> Additional information: The .Net Data OLE DB Provider
> (System.Data.OleDb) does not support
> the MSDASQL Provider, Microsoft OLE DB Provider for ODBC
> Drivers.
>
> I need help
> with this problem as soon as possible please.
>