Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2008, 08:37 AM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default Has anyone learned how to connect to Postgres SQL?

I see this question posted back in 2004 with no responses. It's funny how Microsoft doesn't recognize any other software. On to the question. I have gotten this far:

Code:
...
OleDbConnection conn;
...
OleDbConnectionStringBuilder conStr = new OleDbConnectionStringBuilder();

conStr.DataSource = "localhost";
conStr.Provider = "PostgreSQL.1";
conStr["User ID"] = "<SomeUsername>";
conStr["Password"] = "<SomePassword>";
...
conn = new OleDbConnection(conStr.ConnectionString);
...
conn.Open();
This will connect me to the database engine. But doesn't get me to the database I'm using so queries fail. If I try ... From MyDatabase.MyTable ... I get a schema not found error.

Is there anyone out there who realizes that Microsoft isn't the only software company?


What you don't know can hurt you!
__________________
What you don\'t know can hurt you!
 
Old April 18th, 2008, 09:09 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Have you tried using the .NET provider for Postgre?

http://pgfoundry.org/projects/npgsql/

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old April 18th, 2008, 11:15 PM
Authorized User
 
Join Date: Nov 2006
Posts: 93
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thanks, that did the trick. The instructions on the site were excellent. Had to hunt around for mono.security.dll, but found in the source download.

thanks again.

What you don't know can hurt you!





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to connect with postgres using Vc++ ramananth Visual C++ 2005 0 May 22nd, 2007 07:14 AM
Can't connect to my sql vinu123 Beginning PHP 2 January 30th, 2007 12:17 AM
Cannot Connect to SQL Server JoshCBR28 BOOK: Beginning ASP 3.0 2 October 25th, 2005 10:27 AM
the connect of Wap and Sql bicyle BOOK: Beginning ASP 3.0 0 February 21st, 2004 07:09 AM
Connect to sql database kale_tushar Pro VB 6 8 September 8th, 2003 03:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.