Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to excel
Message
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Jet/Access Engine
Miscellaneous
Thread ID:
01081090
Message ID:
01081779
Views:
13
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());
}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform