The AseCommand object allows you to issue a SQL statement or call a stored procedure against an Adaptive Server database.
ExecuteReader – Use to issue a command that returns a result set. By default, the Provider does not use cursors. The entire result set is fetched on the client side, and the user can fetch the rows one at a time in forward direction only. If the user turns on the use of cursors by adding the following line to the ConnectString:
"Use Cursor=true;"
then the Provider does not fetch the whole result set from the database server and instead uses a forward-only, read-only cursor.
Using cursors can improve performance when you expect your query to return a large resultset, but you do not necessarily expect the client to use the entire resultset.
In either case, you can loop quickly through the rows of the result set in only one direction.
ExecuteScalar – Use to issue a command that returns a single value. This can be the first column in the first row of the result set, or a SQL statement that returns an aggregate value such as COUNT or AVG.
ExecuteXmlReader – Use to issue a command that returns a result set in an XML format. Generally you use this method in select statements with a FOR XML clause.
Instructions to use the Simple code sample included with Adaptive Server ADO.NET Data Provider.