代码
file="c:\\temp\test.csv";



DataSet ds 
= new DataSet();
        
string filePath = file.Substring(0, file.LastIndexOf("\\"+ 1);
        
using (OleDbConnection conn = new OleDbConnection(string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Text;'", filePath)))
        {
            OleDbDataAdapter adp 
= new OleDbDataAdapter(string.Format("SELECT * FROM [{0}]", file.Replace(filePath, "")), conn);
            
try
            {
                adp.Fill(ds, 
"clbm");
            }
            
catch
            {

            }
        }

 

 

相关文章:

  • 2021-07-24
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
相关资源
相似解决方案