private void button1_Click(object sender, EventArgs e)
{
string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\work\\test\\python\\extractopoints;Extended Properties=dBASE IV;User ID=Admin;Password=;";
string fileName = "E:\\work\\test\\python\\extractopoints\\1.dbf";
OleDbConnection con = new OleDbConnection(constr);
var sql = "select * from " + fileName;
OleDbCommand cmd = new OleDbCommand(sql, con);
con.Open();
DataSet ds = new DataSet(); ;
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
foreach (DataRow theRow in ds.Tables[0].Rows)
{
Console.WriteLine(theRow["ID"]);
}
Console.WriteLine("success");
}
c#读取dbf文件并输出某一列
最新推荐文章于 2024-05-17 16:32:30 发布