Last post Oct 25, 2010 11:25 AM by AZMatt
Oct 20, 2010 02:04 PM|domar|LINK
I have a question about the data connection with npgsql.
First, let me introduce you to my test program:
It is a Silverlight 4 Application with an asp.net Webapplication Project.
In the Webapplication Project, I have a reference to the Npgsql.dll from Npgsql2.0.10-bin-ms.net4.0 which I have from pgfoundry.org
I try to open the connection with the following statements:
public class DAL
private NpgsqlConnection con;
con = new NpgsqlConnection(@"Server=DOMAIN;Port=PORT;User Id=USER;password=PASSWORD;Database=DBNAME;");
public void openConnection()
public void closeConnection()
I can't debug the code, because the database is on a server, which I can only access with an special IP so I have to upload the project on a server and run it from there...
I'm calling the methods from a WCF and the problem should be in the con.Open() statement.
The programm stops here without any Output...
Any idea what could be the mistake or how I can debug this or how I can write the exception to a file?
I tried to create a file with StreamWriter but it also fails because there is no file created :(
Oct 20, 2010 05:36 PM|AZMatt|LINK
You could use a try/catch block...
//write out error to a file using ex.ToString()
Oct 20, 2010 05:57 PM|domar|LINK
Well, but how can I write the exception to a file?
As written above, I made a StreamWriter and said
System.IO.StreamWriter sw = System.IO.File.CreateText("Errors.txt");
But there was no File called Errors.txt on the server :(
Oct 25, 2010 11:25 AM|AZMatt|LINK
Depending on the type of authentication, you need to make sure security is set on the location that you are writing the file. It needs write access.