Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel To DataSet Not Working
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01454334
Message ID:
01457300
Views:
37
>I am trying to load an Excel file into a DS. Not all columns are making into the DS. Some columns are empty. Anyone know why this is and what to do about it?
>
>
>OpenFileDialog dialog = new OpenFileDialog();
>dialog.Filter = "Excel Files (*.xls)|*.xls|All files (*.*)|*.*";
>dialog.InitialDirectory = @"c:\";
>dialog.Title = "Select an SQA file";
>DialogResult Result = dialog.ShowDialog();
>
>if(Result == DialogResult.OK)
>{
>    string FileName = dialog.FileName;
>    DataAccess da = new DataAccess();
>    da.ProviderInvariantName = "System.Data.OleDb";
>
>    da.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";" + "Extended Properties=Excel 8.0;";
>
>    DataSet ds = da.ExecuteQuery("select * from [New Quote$]", CommandType.Text);
>}
>
>
>At this point, some columns in the DS are empty.

I haven't tried importing from Excel into a dataset but, given past experience importing Excel data into other file formats, I would guess that there is some datatype that is causing problems. I would look to see if the columns that are coming over blank either have formulas or some unusual formatting.
Linda Harmes
HiBit Technologies, Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform