Die Datei 'C: \ Windows \ System32 \ inetsrv \ example.xls' konnte nicht finden

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Die Datei 'C: \ Windows \ System32 \ inetsrv \ example.xls' konnte nicht finden

by Guest » 07 Feb 2025, 14:03

Ich muss von der angehängten Datei in die SQL -Tabelle exportieren, aber ich erhalte diesen Fehler. Was ist los?

Code: Select all

 String ExcelFileExtension = Path.GetExtension(fileBrowser.FileName);
//Check the user has selected a jpg image
if (ExcelFileExtension == null || ExcelFileExtension.ToLower() != ".xls")
{
userMessage.Text += "The file you have selected is not in the right format. Please use a Excel file.";
return;
} else
{

DataTable table = new DataTable();
string odbcstr = "Data Source=TEST;Initial Catalog=Test1;Integrated Security=SSPI";
using (var stream = File.Open(fileBrowser.FileName, FileMode.Open, FileAccess.Read))
{
IExcelDataReader reader;
reader = ExcelDataReader.ExcelReaderFactory.CreateReader(stream);
var conf = new ExcelDataSetConfiguration
{
ConfigureDataTable = _ => new ExcelDataTableConfiguration
{
UseHeaderRow = true
}
};

var dataSet = reader.AsDataSet(conf);

// Now you can get data from each sheet by its index or its "name"
table = dataSet.Tables[0];

Top