Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Connecting to excel datasheets using C#
I am attempting to write a program that takes Excel datasheet information and
puts it in a Access database. I'm having problems. My datasheet is called 'Baseline & Week1' Here is the relevant code: OleDbDataAdapter oleCmd = new OleDbDataAdapter("SELECT * FROM [Baseline & Week1$]", oleConn); .. . . foreach(DataRow oleRow in oDS.Tables[0].Rows) { write some data } The above code works. However, if I modify my foreach to look like this: foreach(DataRow oleRow in oDS.Tables["[Baseline & Week1$]"].Rows), substituting the actual name of my datasheet in place of '0', I get an "Object reference not set to an instance of an object" error. Is my ' oDS.Tables{"Baseline & Week1$]"] ' syntax incorrect? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Connecting Excel 2007 to MySQL db? | Excel Discussion (Misc queries) | |||
Merge 2 datasheets into single Pivot Table. | Excel Worksheet Functions | |||
Excel datasheet needs dividing into more datasheets | Excel Discussion (Misc queries) | |||
I want to compare old and new datasheets and highlight changes | Excel Worksheet Functions | |||
connecting wordpad and excel | Excel Discussion (Misc queries) |