OdbcDataReader returns no rows after executing query even though there are some in DB
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: OdbcDataReader returns no rows after executing query even though there are some in DB

  1. #1
    Join Date
    Jun 2011
    Posts
    2

    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

  2. #2
    Join Date
    Jun 2011
    Posts
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center