How to Retrieve Data from the Host File System
Just as you can do with other managed data providers, you can access host data with an implementation of a DataReader
object through HostfileCommand
.
To retrieve data using a data reader
Create an instance of
HostFileCommand
.Create a
DataReader
object through a call toHostFileCommand.ExecuteDBDataReader
.Calling
ExecuteDBDataReader
retrieves data rows from the data source.Use
DBDataReader.Read
to obtain a row from the results of the query.You can access each column of the returned row by passing the name or ordinal reference of the column to the
DBDataReader
object. However, for best performance, theDBDataReader
object provides a series of methods that enable you to access column values in their native data types (GetDateTime
,GetDouble
,GetGuid
,GetInt32
, and so on).Once you are finished with the
DBDataReader
object, callDBDataReader.Close
.If your
HostFileCommand
object contains output parameters or return values, they will not be available until theDBDataReader
is closed.Note that while
DBDataReader
is open, theHostFileConnection
is in use exclusively by thatDBDataReader
. You cannot execute any commands for theHostFileConnection
, including creating anotherDBDataReader
, until the originalDBDataReader
is closed.
See Also
Retrieving Information from the Host File System
BizTalk Adapter for Host Files Configuration