2010-03-05 42 views

回答

9

假设您的CSV文件嵌入的资源,你可以这样访问:

using (var stream = Assembly 
    .GetExecutingAssembly() 
    .GetManifestResourceStream("YourNamespace.test.csv")) 
using (var reader = new StreamReader(stream)) 
{ 
    string csv = reader.ReadToEnd(); 
    // do something with the CSV 
} 
+0

谢谢darin ...但我如何使用oledb访问这个文件基本上我应该能够通过“Select * from table”来选择它 – Sathish 2010-03-05 11:05:53