i want to fill data to a strongly typed dataset fom excel.
if i fill this strongly typed dataset with a sheet which has more columns than the typed dataset, these extra columns are put on the end of the typed dataset.
example :
my strongly typed dataset has 3 columns : name, address, id
the excel sheet has 5 columns : name, birthdate, phone, id, email
if i do this :
mynewds has these columns : nam, address, id, birthdate, phone, email.
how can i fill my strongly typed dataset only with columns, which in my strongly typed dataset exist?
thx
if i fill this strongly typed dataset with a sheet which has more columns than the typed dataset, these extra columns are put on the end of the typed dataset.
example :
my strongly typed dataset has 3 columns : name, address, id
the excel sheet has 5 columns : name, birthdate, phone, id, email
if i do this :
C#:
OleDbConnection conn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=" + filename + ";Extended Properties=Excel 8.0;");
conn.Open();
OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", conn);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = cmd;
myDataSet mynewds = new myDataSet();
adapter.Fill(mynewds, "mytable");
conn.Close();
mynewds has these columns : nam, address, id, birthdate, phone, email.
how can i fill my strongly typed dataset only with columns, which in my strongly typed dataset exist?
thx