Failed query blob columns from Paradox databse via ODBC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jmaes Wang
    New Member
    • Oct 2010
    • 7

    Failed query blob columns from Paradox databse via ODBC

    Attached please find my code. I failed to query the blob column. Note the Paradox driver version is 4.0. The error is:

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


    I can query non-blob columns of the table with the same code. Can you please tell me what the problem is? Is this the limitation of .Net Framework Data Provider for ODBC? Do I need to use SQLOLEDB instead? Will SQLOLEDB resolve the issue?

    I notice 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.


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


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


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


    Code:
            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;
            }
  • Jmaes Wang
    New Member
    • Oct 2010
    • 7

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

    I think there mst be a way to import blob columns from Paradox database in C#. Any ideas?

    Comment

    Working...