ADS

Friday 4 May 2018

Executing a select query in asp.net

Executing a select query in asp.net:


Following method of command object should be called to execute sql select query.
Public SqlDataReader ExecuteReader()

ExecuteReader():

After executing select query it store record (returned by database server) into object of sqldatareader class and returns reference of this object.
SqlDataReader  dr= cmd.ExecuteReader();

ResultSet object:

This object that stores select query result is called resultset object.
In asp.net object of sqldatareader class is known as resultset object.

Resultset object:

Result set object maintain a cursor which is initially positioned just before the first record in order to access value of any row from the result set we need to place cursor a that record. Following method of result set object should be called to change cursor position.
Public bool read()
It moves cursor one position forward . If no record is found at that position then it return false otherwise it return true.

No comments:

Post a Comment

Popular Posts