|
|
|
start date: Tue, 14 Aug 2007 14:47:40 -0500,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
TJ am
|
|
2
TJ am
|
ExecuteXmlReader not available in .net 1.1 Enterprise Library Data Access Block ??
I'm trying to upgrade old code in .NET 1.0 to use the data access
application block (June 2005 version).
I'm trying to do this:
SqlCommand custCMD = new SqlCommand(sql, conn);
conn.Open();
XmlTextReader rdr = (XmlTextReader)custCMD.ExecuteXmlReader();
But guess what, there is no ExecuteXmlReader in data access app block, at
least the way I use it, I try this:
Database db = DatabaseFactory.CreateDatabase("myDatabaseName");
DBCommandWrapper dbc = db.GetSqlStringCommandWrapper(mySql);
XmlTextReader rdr = (XmlTextReader)db.ExecuteXmlReader(dbc); <----- THIS
DOESNT EXIST
There is no ExecuteXmlReader off the db object, so what I've written above
won't work.
How do I implement the ExecuteXmlReader using the data access app block in
1.0?
Date:Tue, 14 Aug 2007 14:47:40 -0500
Author:
|
Re: ExecuteXmlReader not available in .net 1.1 Enterprise Library Data Access Block ??
Got it.
SqlDatabase db = (SqlDatabase)DatabaseFactory.CreateDatabase();
SqlCommandWrapper cmd =
(SqlCommandWrapper)db.GetStoredProcCommandWrapper(myProc);
XmlReader xmlRdr = db.ExecuteXmlReader(cmd);
Duh...because the ExecuteXmlReader was originally off the SqlCommand,
I just had to cast the Database object to a SqlDatabase object.
Here's a great article that pointed out the obvious to me:
http://msdn.microsoft.com/msdnmag/issues/05/08/DataPoints/
"TJ" <teejay@newsgroups.nospam> wrote in message
news:OiTUevq3HHA.1188@TK2MSFTNGP04.phx.gbl...
> I'm trying to upgrade old code in .NET 1.0 to use the data access
> application block (June 2005 version).
> I'm trying to do this:
>
> SqlCommand custCMD = new SqlCommand(sql, conn);
> conn.Open();
> XmlTextReader rdr = (XmlTextReader)custCMD.ExecuteXmlReader();
>
> But guess what, there is no ExecuteXmlReader in data access app block, at
> least the way I use it, I try this:
>
> Database db = DatabaseFactory.CreateDatabase("myDatabaseName");
> DBCommandWrapper dbc = db.GetSqlStringCommandWrapper(mySql);
> XmlTextReader rdr = (XmlTextReader)db.ExecuteXmlReader(dbc); <----- THIS
> DOESNT EXIST
>
> There is no ExecuteXmlReader off the db object, so what I've written above
> won't work.
>
> How do I implement the ExecuteXmlReader using the data access app block in
> 1.0?
>
Date:Wed, 15 Aug 2007 08:29:30 -0500
Author:
|
|
|