Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connecting to excel
Message
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:
01081779
Vues:
15
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());
}
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform