日期:2014-05-20  浏览次数:20825 次

关于txt连接字符串问题!
ConnectionString   =   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   +   openFileDialog2.FileName   +   ";Extended   Properties=\ "Text;HDR=yes;FMT=Delimited\ "| ";
                        SQLString   =   "Select   *   from   ReportFile.txt ";

有一以“|”为分隔符的txt文档,想导入dataset,请问高手,用连接字符串方法可以吗?如果行,以上的连接字符串有什么问题?


------解决方案--------------------
1、ODBC
oConn.Open "Driver={Microsoft Text Driver (*.txt; *.csv)}; " & _
          "Dbq=c:\somepath\; " & _
          "Extensions=asc,csv,tab,txt; " & _
          "Persist Security Info=False "
2、OLEDB
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
          "Data Source=c:\somepath\; " & _
          "Extended Properties= " "text;HDR=Yes;FMT=Delimited; " "; "

------解决方案--------------------
FMT=Delimited; " "; " 我这里用的是;,你换成|,不就行了。。。。