#region 返回DBF表
public static System.Data.DataTable getDTFromDBF(string fullPath)
{
string pDir = System.IO.Path.GetDirectoryName(fullPath);
string pFile = System.IO.Path.GetFileNameWithoutExtension(fullPath);
return getDTFromDBF(pDir, pFile);
}
public static System.Data.DataTable getDTFromDBF(string dir, string file)
{
string connStr = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=" + dir + ";Exclusive=No;";
OdbcConnection conn2 = new OdbcConnection(connStr);
System.Data.DataTable tableTJ = null;
try
{
conn2.Open();
string sqlGetTypes = "select * from " + file;
OdbcDataAdapter daTJ = new OdbcDataAdapter(sqlGetTypes, conn2);
tableTJ = new System.Data.DataTable();
daTJ.Fill(tableTJ);
}
catch (Exception ex)
{ }
finally
{
conn2.Close();
}
return tableTJ;
}
#endregion
 
 

读取DBF文件数据的更多相关文章

  1. python3 读取dbf文件报错 UnicodeDecodeError: 'gbk' codec can't decode

    在读取dbf文件时由于编码问题报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xb5 in position 49: incomplete ...

  2. C# 解决读取dbf文件,提示Microsoft Jet 数据库引擎找不到对象的问题

    前言 最新项目需要经常和dbf文件打交道,在实际场景中很多软件需要和一些老的系统进行数据交互,而这些系统都在使用foxpro数据库,读取dbf文件一般都是分为两种情况:第一:安装foxpro的驱动进行 ...

  3. 上传读取Excel文件数据

    /// <summary> /// 上传读取Excel文件数据 /// 来自http://www.cnblogs.com/cielwater /// </summary> // ...

  4. 读取DBF文件的部分代码

    private void BtnOpenInitial_Click(object sender, EventArgs e) { OpenFileDialog file = new OpenFileDi ...

  5. Unity 用C#脚本读取JSON文件数据

    读取JSON文件数据网上有很多方法吗,这里采用SimpleJSON,关于SimpleJSON的介绍参考以下链接:http://wiki.unity3d.com/index.php/SimpleJSON ...

  6. spring 框架的xml文件如何读取properties文件数据

    spring 框架的xml文件如何读取properties文件数据 第一步:在spring配置文件中 注意:value可以多配置几个properties文件 <bean id="pro ...

  7. Android - 读取JSON文件数据

    Android读取JSON文件数据 JSON - JavaScript Object Notation 是一种存储和交换文本信息的语法. JSON对象在花括号中书写.用逗号来分隔值. JSON数组在方 ...

  8. python使用h5py读取mat文件数据,并保存图像

    1 安装h5py sudo apt-get install libhdf5-dev sudo pip install h5py 假设你已经安装好python和numpy模块 2 读取mat文件数据 i ...

  9. sas通过IMPORT过程读取外部文件数据

    SAS通过IMPORT过程读取外部文件数据 使用IMPORT过程导入带分隔符的文件外,Microsoft Access数据库文件.Miscrosft Excel工作簿. dBase文件.JMP文件.S ...

随机推荐

  1. 解决ORA-14450:试图访问已经在使用的事务处理临时表

    select * from dba_objects where object_name='TEMP_MZGL_BRSFD'; select 'alter system kill session ''' ...

  2. C++关于Condition Variable

    #include <condition_variable> #include <mutex> #include <future> #include <iost ...

  3. 开始学习Dojo

    学习:Dojo入门简易教程 Dojo Toolkit 简介 Dojo 于 2004 年创建,使开发 DHTML 和 JavaScript web 应用程序开发流程更为容易,隐藏了很多现代 web 浏览 ...

  4. BZOJ 3176 Sort

    先一遍reverse+逆序对个数. 要开long long啊. #include<iostream> #include<cstdio> #include<cstring& ...

  5. 盲注----基于布尔的SQL盲注

    构造逻辑判断常用字符串截取函数http://www.cnblogs.com/yyccww/p/6054569.html常用函数left(a,b)  从左侧截取a的前b位right(a,b)  从右侧截 ...

  6. NOIP 考前 队列复习

    BZOJ 1127 #include <cstdio> #include <cstring> #include <iostream> #include <al ...

  7. 【LeetCode OJ】Validate Binary Search Tree

    Problem Link: https://oj.leetcode.com/problems/validate-binary-search-tree/ We inorder-traverse the ...

  8. .net web端导出Excel个人的看法

    //对已有方法进行重写 public override void VerifyRenderingInServerForm(Control control) { } //设置文件名 string fil ...

  9. 条件随机场(CRF) - 2 - 定义和形式(转载)

    转载自:http://www.68idc.cn/help/jiabenmake/qita/20160530618218.html 参考书本: <2012.李航.统计学习方法.pdf> 书上 ...

  10. 观 GT Java语言管理系统的感悟

    继上次java系统考核完... 坦白说,我对我自己写的例子还是很满意的,虽说学长们给的评价不高 ,但我一直以为是学长们对我们的要求太高,以他们的眼光在看待我们,所以我对学长们给的评价并没有太过在意,当 ...