DataTable part8 = new DataTable(); part8 = loadData(path, "SELECT * FROM [Gaszähler$X13:Y]"); Console.WriteLine(part8.Rows[10][1]); private DataTable loadData(String path, String command) { String filepath = path; String db_command = command; OleDbDataAdapter adapter = fetch(filepath, db_command); DataSet set = new DataSet(); DataTable returntable = new DataTable(); adapter.Fill(set, "table1"); returntable = set.Tables["table1"]; return returntable; } public OleDbDataAdapter fetch(string filepath, string com) { OleDbConnection conn = new OleDbConnection(); // Die Verbindung string ConStr = // Der Connectionstring @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source = " + filepath + @";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0"""; conn.ConnectionString = ConStr; //Der Connectionstring wird gesetzt OleDbCommand command = new OleDbCommand // Das OleDb Kommando ( com, conn ); OleDbDataAdapter myAdapter = new OleDbDataAdapter(command); // Ein Adapter return myAdapter; }
WriteLine(double)
Double.ToString()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)