Search code examples
c#.netodbcdbf

ODBC driver generate 8,3 .DBF file


I'm developed a program in c# .net, i need to generate a .dbf file, its working on my computer when im building the app with visual studio. But if i compiled it to the server it's generate 8,3 files, it means the filename is 8 character, but i need more. The ODBC driver is same. What can i do?

using (var dBaseConnection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + DBFPath + ";Extended Properties=dBASE III;"))
            {
                dBaseConnection.Open();
                string str0 = @" Create Table " + FileNameBase + FileNameSuffix + " (NKAZON char(244), ADOSZAM char(244), DATUM char(244), GYNEV char(244), TTT char(244), TKSZAM char(244), KSZ char(244), NYITO char(244), BESZ char(244) );";
                var cmd2 = new OleDbCommand(str0, dBaseConnection);
                cmd2.ExecuteNonQuery();
                foreach (var item in ExportDBF)
                {
                    string str1 = @" INSERT INTO " + FileNameBase + FileNameSuffix + " (NKAZON, ADOSZAM, DATUM, GYNEV, TTT, TKSZAM, KSZ, NYITO, BESZ) VALUES(" + "'" + item.NKAZON + "'," + "'" + item.ADOSZAM + "'," + "'" + item.DATUM.ToString("yyyyMM") + "'," + "'" + item.GYNEV + "'," + "'" + item.TTT + "'," + "'" + item.TKSZAM + "'," + "'" + item.KSZ + "'," + "'" + item.BESZ + "'," + "'" + item.NYITO + "');";
                    var cmd = new OleDbCommand(str1, dBaseConnection);
                    cmd.ExecuteNonQuery();
                }

            }

Solution

  • Okay, i solved the problem, i need to install office 365 and run access one time in the server.