使用C#把dbf格式文件的数据导入到sqlserver中

时间:2021-08-22 04:41:08

SQL语句如下:

string sql = @"delete yzxt "+
      "insert into yzxt ( service_id,name,apply_st,stop_date,home_ph,address,bp,customer_l,id,"+
      "district_i,serving_st,source_id,service_fa,preserve15,innet_meth,service_gr,fee_kind,sumfee) "+
      "select service_id,name,apply_st,stop_date,home_ph,address,bp,customer_l,id,district_i,"+
      "serving_st,source_id,service_fa,preserve15,innet_meth,service_gr,fee_kind,sumfee from openrowset('"+
      "MSDASQL','Driver=Microsoft Visual FoxPro Driver; SourceDB="+this.filepath+"; SourceType=DBF', 'select * from "+this.filepath+"') where serving_st in (select id from dic_status) and serving_st <> '9'" ;