2010-03-05 70 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