DataContext Database Source

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Zoran
Posts: 44
Joined: Thu 28 Apr 2005 21:55
Location: Zagreb, Croatia

DataContext Database Source

Post by Zoran » Tue 09 Dec 2008 14:52

I create DataContext using the same connection string that works for PgSqlConnection:
DataContext dataContext = new DataContext("DATABASE=***;USER ID=***;PASSWORD=***;SERVER=localhost");
However, here I get (later, when executing a query) an error message:

"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

I assume the this is because DataContext doesn't know that I do not want to open a connection for MS SQL Server but for PostreSQL. How can I select database source for DataContext?[/b]

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 10 Dec 2008 07:49

If you want to work with LINQ to PostgreSQL, you should use Entity Developer.
Create data model in it, generate the code classes in your project directory.
Then add this code file to your project, also add the required references.
These actions will let you work with DataContext specific to LINQ to PostgreSQL.

Zoran
Posts: 44
Joined: Thu 28 Apr 2005 21:55
Location: Zagreb, Croatia

It works

Post by Zoran » Wed 10 Dec 2008 22:13

Thanks. In the generated code I found the name of class and the attributes.

Post Reply