当前位置:编程学习 > C#/ASP.NET >>

如何直接打开dbf文件

想直接打开dbf文件,oledb、odbc的方法皆可,请问连接语句该怎么写?
我尝试了下面的写法
            string strConnection = @"Dsn=Visual FoxPro Tables;sourcedb=" + Application.StartupPath + "\\Road"+ ";sourcetype=DBF;exclusive=No;backgroundfetch=Yes;collate=Machine";
            OdbcConnection thisConnection = new OdbcConnection(strConnection);
            thisConnection.Open(); 
结果报错,请各位帮帮忙,谢谢  --------------------编程问答-------------------- 我使用这种方式,说找不到turntable表格            
string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\\Road" + @";Extended Properties=""dBASE IV;HDR=Yes;"";";

            OleDbDataAdapter adpt = new OleDbDataAdapter("Select * From turntable", strConn);

             DataSet mySet = new DataSet();

            adpt.Fill(mySet);      --------------------编程问答-------------------- dbf你可以当作文本文件来处理.关于格式可以参考:
http://blog.163.com/jing_wei299/blog/static/618063912008111171316834/ --------------------编程问答--------------------  "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + Environment.CurrentDirectory + ";Exclusive=yes;NULL=yes;Collate=Machine;BACKGROUNDFETCH=yes;DELETED=yes"; --------------------编程问答--------------------

OdbcConnection conn = new OdbcConnection();
            DataTable dt = new DataTable();
            try
            {
                string table = dbPath;
                string connStr = @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + table + ";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO";

                conn.ConnectionString = connStr;
                conn.Open();

                OdbcDataAdapter da = new OdbcDataAdapter(sql, conn);

                da.Fill(dt);

            }
            catch (Exception ex)
            {
            }
--------------------编程问答-------------------- System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
    string table = @"C:\a.dbf";
    string str= @"Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + table + ";Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO";
    conn.ConnectionString = str;
    conn.Open();
http://topic.csdn.net/u/20080519/22/b961246d-6f57-4353-b247-ec69af63d99e.html
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,