473,473 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C# .NET ===> postgreSQL

2 New Member
I am creating a C# .NET application that uses a postgreSQL database that is on my machine locally. My problem is that I cannot figure out how to write the connectionString. I have searched the internet for the past 30 minutes trying everything I could find.

Help? anyone?


Expand|Select|Wrap|Line Numbers
  1. public class Connection
  2. {
  3.     protected static SqlConnection conn;
  4.     private const string connStr = "???";
  5.  
  6.     public static SqlConnection getConnection()
  7.     {
  8.         if(conn == null)
  9.         {
  10.             conn = new SqlConnection(connStr);
  11.             conn.Open();
  12.         }
  13.         return conn;
  14.     }
  15. }
Mar 11 '07 #1
1 1349
kenobewan
4,871 Recognized Expert Specialist
You can use odbc or npgsql. Here is an example using Npgsql:
Expand|Select|Wrap|Line Numbers
  1. String connstring = "Server=xx.xx.xx.xx;Port=5432;User
  2. id=user;Password=password;Database=dbname";
Mar 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Levent | last post by:
Folks, I am getting following message from pear. I am running RedHat 8.0, PostgreSQL is 7.3.2 PHP Version 4.2.2 and pear:db 1.6.5. Warning: pg_errormessage(): supplied argument is not a valid...
2
by: Rene Pijlman | last post by:
I can't seem to find any way to specify the character encoding with the DB API implementation of PyPgSQL. There is no mention of encoding and Unicode in the DB API v2.0 spec and the PyPgSQL README....
2
by: aum | last post by:
Hi, I'm looking for an object-relational layer, which can wrap a MySQL database into highly pythonic objects. There seem to be dozens of packages which provide some of this functionality, but...
12
by: Sander Smeenk | last post by:
Hi, After a very recent postgresql update, the postmaster failed to start because of this: | PANIC: The database cluster was initialized with LC_CTYPE | 'nl_NL@euro.UTF-8', which is...
9
by: Christian Wetzig | last post by:
hi, i have a table with test_field of type "TEXT". when i do: select test_field from test where id=1; the connection (with psql) hangs and no output is received, so i have to kill psql. ...
1
by: Eric | last post by:
Hi, I would like to know if a daemon exist to intercept Oracle queries and translate to postgresql query... I have a windows app (AccPac) that connect to an Oracle server via ODBC. I would...
2
by: Zlatko Matić | last post by:
Hello. I have the following problem with MS Access/PostgreSQL combination: There is a form in Access that has an unbound text box, used for entering a commentary of a batch of records. There is a...
8
by: bill.postgresql-users | last post by:
I installed 7.4 from the FreeBSD ports collection (I'm running 4.9-RELEASE). Did nothing special, just make && make install and all was well. I now have updated my ports collection via cvsup and...
5
by: Silvio Matthes | last post by:
Hello, I'm new to the list and did not find a suitable answer to my question so here it is: I try to select the rows of a table where the content of a varchar-column is empty ('') and...
1
by: DEHAINSALA Hondjack | last post by:
Hi ! sorry for my english ! I am french :-) I want to test postgreSQL v8 native Windows! Where i can get a version which allows more than 64 characters (NAMEDATALEN ~=128) to the name of tables...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.