Hejka,
Mam taki problem.
Aktualnie pobieram dane z excela uzywajac OLEDB
try {
string sqlquery = SELECT +" From ["+SheetName+"$] " + WHERE;
DataSet ds = new DataSet();
string constring = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";Extended Properties=\"Excel 12.0 Xml;HDR="+HEADERS+";IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";
OleDbConnection con = new OleDbConnection(constring);
OleDbDataAdapter da = new OleDbDataAdapter(sqlquery, con);
da.Fill(ds);
DataTable dt = ds.Tables[0];
outputCollection = dt;
Result = "Success";
}
catch (Exception e)
{
Result = "Failed. "+e;
DataTable dt = new DataTable();
outputCollection = dt;
}
Wiem, ze nie jest to zbyt optymalne rozwiazanie ale i tak dziala dobrze.
PROBLEMEM jest to, ze jezeli mam kolumne z datami, to pobiera date w formacie datetime i odejmuje godzine. Probowalem definiowac kolumny itp. ale nie dziala. Aktualne obejscie to zmiana daty na numer w excelu i pobranie jej w taki sposob, wtedy jest ok.
Czy ktos juz mial taki problem? Wie jak to obejsc?
Dzieki