Answered by:
Whats wrong with this that i cant get connected..

Question
-
public DataSet JRR(int id) { DataSet dsJRR = new DataSet(); *******> NpgsqlConnection conn = new NpgsqlConnection("Server=localhost;Port=5432;User Id=XXXXXX;Password=XXXXXX;Database=JRR;"); NpgsqlCommand command = new NpgsqlCommand("select * from jrrinfo", conn); conn.Open(); NpgsqlDataReader dr = command.ExecuteReader(); NpgsqlDataAdapter npgData = new NpgsqlDataAdapter(command); try { while (dr.Read()) { int i; for (i = 0; i < dr.FieldCount; i++) { npgData.Fill(dsJRR, "JRRInfo"); Console.Write("{0} \t", dr[i]); } Console.WriteLine(); } } catch { } finally { conn.Close(); } return dsJRR; }
I am trying to debug this so i can populate my application.. it makes it to the connection line and never displays the data on the page.. no error or exception, just loads the page and never makes it past the connection line to the command line..
- Moved by Annabella Luo Thursday, March 29, 2012 1:01 AM (From:Windows Presentation Foundation (WPF))
Tuesday, March 13, 2012 4:25 PM
Answers
-
Ok thats really strange but maybe someone in the General C# Forum has more experiences in that. You can try to ask for help there.
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, March 29, 2012 6:55 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:23 AM
Thursday, March 15, 2012 4:37 PM -
Created another post in the c# forum
http://forums.asp.net/p/1780780/4882257.aspx/1?p=True&t=634674132641346266
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, March 29, 2012 6:55 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:23 AM
Thursday, March 15, 2012 5:02 PM -
Created another post in the c# forum
http://forums.asp.net/p/1780780/4882257.aspx/1?p=True&t=634674132641346266
Also Visual C#: http://social.msdn.microsoft.com/Forums/en-US/category/visualcsharp
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Proposed as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:23 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:24 AM
Monday, April 9, 2012 5:23 AM
All replies
-
Is your connection string right, including the port? Do you have a firewall running that's causing the connection to hang/timeout?
Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".Tuesday, March 13, 2012 4:47 PM -
i have found examples to use and everythign is correct, i even changed to try using
OleDbConnection i can get further into the lines, but still no errors and never gets past the Open() line..
Tuesday, March 13, 2012 5:22 PM -
i have found examples to use and everythign is correct, i even changed to try using
OleDbConnection i can get further into the lines, but still no errors and never gets past the Open() line..
Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".Tuesday, March 13, 2012 8:21 PM -
just tried.. turned it off.. rebuilt my app and started it.. made it to the "Conn" line but never goes to the next line conn.Open() skips that and loads the app with no errors or messages..
Tuesday, March 13, 2012 9:14 PM -
if i switch over to the ole code, i get this error message
'conn.ServerVersion' threw an exception of type 'System.InvalidOperationException'
Tuesday, March 13, 2012 9:21 PM -
After more debugging here is another error or more details on the error received.. can anyone offer any other suggestions or see what is wrong
Thursday, March 15, 2012 2:51 PM -
Hey, your code looks right but maybe you have some troubles with localhost? So try to write 127.0.0.1
Another issue could be SSL!?
- Edited by Mr. Jochen Thursday, March 15, 2012 4:14 PM
Thursday, March 15, 2012 4:13 PM -
Well thats the thing.. i have tried localhost, 127.0.0.1 and even our remote server and regardless of which one it always returns that error..
I can connect using all 3 servers from within pgAdmin III, so atleast i know that the user and password are correct.. I was even trying the ODBC method and within the ODBC admin where you setup the DSN that connected successfully to the remote server but within my code, it still returns the same error on the same line..
So seems to point to an issue with the c# side..
Thursday, March 15, 2012 4:28 PM -
Ok thats really strange but maybe someone in the General C# Forum has more experiences in that. You can try to ask for help there.
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, March 29, 2012 6:55 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:23 AM
Thursday, March 15, 2012 4:37 PM -
Created another post in the c# forum
http://forums.asp.net/p/1780780/4882257.aspx/1?p=True&t=634674132641346266
- Proposed as answer by Ed Price - MSFTMicrosoft employee Thursday, March 29, 2012 6:55 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:23 AM
Thursday, March 15, 2012 5:02 PM -
Created another post in the c# forum
http://forums.asp.net/p/1780780/4882257.aspx/1?p=True&t=634674132641346266
Also Visual C#: http://social.msdn.microsoft.com/Forums/en-US/category/visualcsharp
Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)
- Proposed as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:23 AM
- Marked as answer by Ed Price - MSFTMicrosoft employee Monday, April 9, 2012 5:24 AM
Monday, April 9, 2012 5:23 AM