Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connecting to excel
Message
De
29/12/2005 16:36:54
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Jet/Access Engine
Divers
Thread ID:
01081090
Message ID:
01081860
Vues:
19
David,
Column names come from first row in excel. Check columns collection for their names or use ordinals instead.
Cetin

>Sorry, found the answer its not "DataSource" but "Data Source".
>
>I'm also having a problem with the names of the colums in the excel sheet, I'm referring to them as "A" and "B" and so on. But that doesnt seem to work. Keeps telling me there is no datacolumn by the name of "B" or "H", I think I'm just getting the column names wrong?
>
>
>OleDbConnection myConn = new OleDbConnection(Conn);
>OleDbCommand myComm = new OleDbCommand("select * from [Sheet1$]",myConn);
>OleDbDataAdapter adapt = new OleDbDataAdapter();
>adapt.SelectCommand = myComm;
>DataSet ds = new DataSet();
>myConn.Open();
>adapt.Fill(ds);
>myConn.Close();
>DataView dv = new DataView(ds.Tables[0]);
>foreach (DataRowView drv in dv)
>{			MessageBox.Show(drv["B"].ToString().Trim()+drv["H"].ToString().Trim()+drv["I"].ToString().Trim());
>}
>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform