C# Read Excel data that is linked to Oracle DB -


how read data excel.xslx linked oracle? can read entire sheet fine using c# , print console window, data being pulled (and refreshed every often) cannot read named range or table. have tested reading data named ranges/tables in other workbooks (not being pulled oracle) fine. prefer not read entire sheet. question how refer linked data named range or table in sql query using c#, or if there other way read linked data excel? code posted below followed output error (which has no build warnings/errors), 'persontable' named range gave data being pulled oracle11g.

using system; using system.collections.generic; using system.linq; using system.text; using system.data.oledb;  namespace readexcelnamedrage {     class program     {         static void main(string[] args)         {             string connectionstring = "provider=microsoft.ace.oledb.12.0; data source=c:\\documents , settings\\jhamandi\\desktop\\hroracletest.xlsx;extended properties=excel 8.0";             //select using named range             string selectstring = "select * persontable";              //select using worksheet name            // string selectstring = "select * [sheet1$]";              oledbconnection con = new oledbconnection(connectionstring);             oledbcommand cmd = new oledbcommand(selectstring, con);              try             {                 con.open();                 console.writeline("connection opened");                 oledbdatareader thedata = cmd.executereader();                 while (thedata.read())                 {                     console.writeline("{0}: {1} ({2}) - {3} ({4})", thedata.getdouble(0),                         thedata.getstring(1), thedata.getstring(2), thedata.getstring(3), thedata.getstring(4));                    // console.writeline("writing");                 }             }             catch (exception ex)             {                 console.writeline(ex.message);             }                         {                 con.dispose();                 console.writeline("connection closed");             }         }     } } 

connection opened microsoft access database engine not find object persontable. ma ke sure object exists , spell name , path name correctl y. if persontable not local object, check network connection or cont act server administrator. connection closed press key continue . . .


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -