Visual Fox Pro oledDB provider error "No value or one or more paramter required" in reading DBF ukranian files in execute reader()

Deepan Chakravarthy 1 Reputation point
2020-12-01T16:03:51.79+00:00

Dear Team,

We are using VFPOLEDB data provider. We need to read the DBF file and convert this into CSV file. we are using VFPOLEDB.1 data provider to read the ukraninan file name ПолесьеПродукт_Товары.DBF. While executing line execute reader(), we are getting an error "No value or one or more paramter required". This is working fine when we have normal English character in the filename like ABC.dbf or TEST.DBF..etc. The problem lies only when we have non English character like Ukrainian letters in the file name then we are getting exception in execute reader() method.

             dbfFilename = Path.GetFileName(FilePath);
            string connvalue = @"Provider=VFPOLEDB.1;Data Source=" + InputFileInfo.DirectoryName + ";";
            using (OleDbConnection oleDbConnectionStr = new OleDbConnection(connvalue))
            {
                oleDbConnectionStr.Open();

                if (oleDbConnectionStr.State == ConnectionState.Open)
                {
                    string mySql = "select * from [" + dbfFilename + "]";
                    OleDbCommand myQuery = new OleDbCommand(mySql, oleDbConnectionStr);
                    OleDbDataReader reader = myQuery.ExecuteReader();
                    DataTable dtSchema = reader.GetSchemaTable();
                    DataTable dtDbf = new DataTable();
                    List<DataColumn> listCols = new List<DataColumn>();
                    string columnName = string.Empty;
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,097 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Cheong00 3,466 Reputation points
    2020-12-02T03:22:55.697+00:00

    AFAIK, Foxpro does not support Unicode. So to open a file with Ukrainian filename, you need either of the following:

    1) Set your non-Unicode language of Windows system to the code page the file is created (e.g.: 848/866/1123).
    2) I remember ODBC v3+ requires Unicode support. So you may want to switch to ODBC connection instead and see if you can get a free ride of automatic conversion.
    3) Rename the files in .NET to English before use OledbConnection to open it. Use a lookup list to keep track of what filename it originally was.

    0 comments No comments