-
June 9th, 2011, 07:10 AM
#1
OdbcDataReader returns no rows after executing query even though there are some in DB
Hi,
I'm getting pretty desperate with my database access logic. I have an ASP.NET application connecting to a PostgreSQL db using ODBC (on Windows 7, 64bit). I have VS 2008 and .NET 3.5 installed on the machine.
I'm trying to get data like so:
this.SetCommandProperties(statement, parameters, commandTimeout);
OdbcDataReader resultReader = odbcCommand.ExecuteReader();
but after the above code has executed, resultReader.HasRows returns false and resultReader.Read() also returns false.
I'm sure the query should have results because:
1) I enabled query tracing in PostgreSQL and the query with correctly assigned parameters showed up in the PostgreSQL log. Then I ran the query using pgAdmin and it returned the rows I needed
2) I also inspected the application using Wireshark - to the application's query there came a response with the needed rows.
So it looks like my ODBC driver is broken or misconfigured or something... Any ideas? Please help!
Machinery
-
June 9th, 2011, 08:41 AM
#2
Re: OdbcDataReader returns no rows after executing query even though there are some i
Problem solved :-) I was using an incorrect PostgreSQL ODBC driver. Instead of using a 32-bit driver for 8.3 I was using a 64-bit driver for 9.0.
Take care,
Machinery
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|