by Manuel
12/13/2007 9:38:00 AM
private DataSet ReadDataSet(string dataPath)
{
DataSet ds = new DataSet();
ds.ReadXml(dataPath, XmlReadMode.ReadSchema);
return ds;
}
private void WriteDataSet(DataSet ds, string path)
{
ds.WriteXml(path, XmlWriteMode.WriteSchema);
}
by Manuel
12/13/2007 9:35:00 AM
public DataSet GetCSVFile( string fileName)
{
string pathName = System.IO. Path .GetDirectoryName(fileName);
string file = System.IO. Path .GetFileName(fileName);
OleDbConnection excelConnection = new OleDbConnection
(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ pathName + ";Extended Properties=Text;");
OleDbCommandexcelCommand = newOleDbCommand(@"SELECT * FROM "+ file, excelConnection);
OleDbDataAdapterexcelAdapter = newOleDbDataAdapter(excelCommand);
excelConnection.Open();
DataSetds = newDataSet();
excelAdapter.Fill(ds);
excelConnection.Close();
return ds;
}