none
How can I query blob columns from Paradox database via ODBC? RRS feed

  • Question

  • Hi,

    I want to read blob columns from Paradox database using c#. Here is my code:

     DataSet dsUsers = new 
    DataSet();
    
     string 
    strQuery = "SELECT blobColumn FROM users"
    ;
    
     dsUsers = GetNames(strQuery, "Driver={Microsoft Paradox Driver (*.db )}; Default Dir=<directory>;DBQ=<directory>"
    );
    

     
     private DataSet GetNames(String strQuery, String strConnect)
    
     {
    
     DataSet dsNames = new DataSet();
    
     try
    
     {
    
     OdbcConnection conOdbc = new OdbcConnection(strConnect);
    
     OdbcCommand cmdOdbc = new OdbcCommand(strQuery, conOdbc);
    
     OdbcDataAdapter odaOdbc = new OdbcDataAdapter(cmdOdbc);
    
     odaOdbc.Fill(dsNames);
    
     conOdbc.Open();
    
     conOdbc.Close();
    
     }
    
     catch (OdbcException eExc)
    
     {
    
     }
    
     catch (Exception eExc)
    
     {
    
     }
    
     return dsNames;
    
     }


    Note that the Paradox driver version is 4.0.

    The code failed to query the blob column.  The error is:

    Error code: -2146232009
     Error msg: ERROR [07002] [Microsoft][ODBC Paradox Driver] Too few parameters. Expected 1.
     Source: odbcjt32.dll

    Please note that I can query non-blob columns of the table with the same code. I tried placing the blob column after the other non-blob columns, I still got the same error.

    I also tried Microsoft OLE DB provider using the following code. There was also an error:
    "No value given for one or more required parameters."

       System.Data.OleDb.OleDbConnection ParConn;
       DataTable schemaTable;
       ParConn = new
     System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\db;"
    +
         "Extended Properties=Paradox 4.x; Persist Security Info=False"
    );
       System.Data.OleDb.OleDbCommand myCmd = new
     System.Data.OleDb.OleDbCommand();
       System.Data.OleDb.OleDbDataReader myReader;
       myCmd.CommandType = CommandType.Text;
       myCmd.Connection = ParConn;
       myCmd.CommandText = "SELECT blobColumn FROM users"
    ;
       ParConn.Open();
       myReader = myCmd.ExecuteReader(CommandBehavior.SequentialAccess);
       schemaTable = myReader.GetSchemaTable();
       ParConn.Close();
    


    I noticed the following statement at http://msdn.microsoft.com/en-us/library/aa215269%28SQL.80%29.aspx:

    When using the Microsoft OLE DB provider for ODBC with the SQL Server ODBC driver, all BLOB columns should be arranged after columns with other data types in a source rowset. You can use a SELECT statement to rearrange the BLOB columns to the end of the source rowset. The DTS Import/Export Wizard performs this operation automatically.

    Again I tried placing the blob column after the other non-blob columns, I still got the same error.

    Can you please tell me what the problem is? Is this the limitation of .Net Framework Data Provider for ODBC or Microsoft OLE DB provider for ODBC?  

    I also tried "Import and Export Data" Wizard shipped with SQL Server Management studio. I couldn't import the table with blob columns.

    I'm hitting the wall. Please help!

    • Moved by KJian_ Monday, October 18, 2010 8:09 AM (From:SQL Server Data Access)
    • Edited by Hong Wang Monday, October 18, 2010 11:46 PM
    Friday, October 15, 2010 5:26 AM

Answers

All replies

  • You need a real Paradox driver.  The Microsoft one does not support reading blobs:

    http://support.microsoft.com/kb/300189

    Per wikipedia:

    The latest version of Paradox released by Corel is 11.0.0.663 which is bundled with X4 Service Pack 1.<sup id="cite_ref-WordPerfect_Office_X4_Professional_Service_Pack_1_2-0" class="reference">[3]</sup>

     

    Monday, October 18, 2010 4:39 PM
    Moderator
  • Hi Matt,

    Thanks for your answer.

    I'll download WP office to see whether I can use its ODBC paradox driver with my .NET code. It seems the driver is also licensed.

    I downloaded Pogress DataDirect Connect for ODBC. It seems that there is no ODBC Paradox driver.

    Are there any other ODBC Paradox drivers that can be used with a .NET application?

     

    Wednesday, October 20, 2010 12:29 AM