110,533
社区成员
发帖
与我相关
我的任务
分享
string csvPath = textBox1.Text;
string fileFullName = Path.GetFileName(csvPath);
string folderPath = csvPath.Substring(0, csvPath.LastIndexOf('\\') + 1);
string connStr = string.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='text;HDR=Yes;IMEX=1'", folderPath);
string sql = string.Format(@"SELECT * FROM [{0}]", fileFullName);
OleDbDataAdapter da = new OleDbDataAdapter(sql, connStr);
da.Fill(ds);