How to pull DataSet from Oracle in .NET?
I am a seasoned .NET / SQL Server developer. I just started a new contract where client is using Oracle, which i've no experience in.
I'm trying to create a WinForms application that will need to talk to the Oracle DB. My frst step was creating a ORacle querying API (which I normally would do in a new MS SQL based project).. I wanted to have a few methods - one such as GetDataSet which returns dataSet.. same for nonquery, scalar, etc...
Well... I can't find ExecuteDataSet inside Oracle.Client namespace. ExecuteNonQuery et al is there... but no DataSet? Can anyone help and fill me in on what I'm missing?
Greatly apprecia开发者_如何学JAVAted!
When I'm not using an ORM for Oracle work, I usually use the Enterprise Library, which has the methods you are looking for.
Database db = DatabaseFactory.CreateDatabase("connectionStringName");
DbCommand cmd = db.GetSqlStringCommand(myQuery);
// Set parameters, etc. ...
var dataset = db.ExecuteDataSet(cmd);
You can use the ODP for .NET more
精彩评论