Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel To DataSet Not Working
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01454334
Message ID:
01457300
Vues:
38
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform