TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
steven
NA
24
41.9k
How the method SqlDataReader.Read() work?
Aug 10 2011 5:26 AM
this is the reflector code, basically, the data should be come from Socket, right? Then, how about the middle process? i want to know some details. socket -----------(middle process)-------------> SqlDataReader.GetString(...)
Can someone explain more? Thanks in advance.
public override bool Read()
{
return this.ReadInternal(true);
}
private
bool
ReadInternal(
bool
setTimeout)
{
bool
flag;
SqlStatistics statistics
=
null
; IntPtr ptr; Bid.ScopeEnter(
out
ptr,
"
<sc.SqlDataReader.Read|API> %d#
"
,
this
.ObjectID);
RuntimeHelpers.PrepareConstrainedRegions();
try
{
statistics
=
SqlStatistics.StartTimer(
this
.Statistics);
if
(
this
._parser
==
null
)
{
goto
Label_017B;
}
if
(setTimeout)
{
this
.SetTimeout();
}
if
(
this
._dataReady)
{
this
.CleanPartialRead();
}
this
._dataReady
=
false
;
SqlBuffer.Clear(
this
._data);
this
._nextColumnHeaderToRead
=
0
;
this
._nextColumnDataToRead
=
0
;
this
._columnDataBytesRemaining
=
-
1L
;
if
(
this
._haltRead)
{
goto
Label_016A;
}
if
(
this
.HasMoreRows())
{
while
(
this
._stateObj._pendingData)
{
if
(
this
._altRowStatus
!=
ALTROWSTATUS.AltRow)
{
this
._dataReady
=
this
._parser.Run(RunBehavior.ReturnImmediately,
this
._command,
this
,
null
,
this
._stateObj);
if
(
!
this
._dataReady)
{
continue
;
}
}
else
{
this
._altRowStatus
=
ALTROWSTATUS.Done;
this
._dataReady
=
true
;
}
break
;
}
if
(
this
._dataReady)
{
this
._haltRead
=
this
.IsCommandBehavior(CommandBehavior.SingleRow);
return
true
;
}
}
if
(
!
this
._stateObj._pendingData)
{
this
.CloseInternal(
false
);
}
goto
Label_018E;
Label_010E:
this
._dataReady
=
this
._parser.Run(RunBehavior.ReturnImmediately,
this
._command,
this
,
null
,
this
._stateObj);
Label_012E:
if
(
this
._stateObj._pendingData
&&
!
this
._dataReady)
{
goto
Label_010E;
}
if
(
this
._dataReady)
{
this
.CleanPartialRead();
}
this
._dataReady
=
false
;
SqlBuffer.Clear(
this
._data);
this
._nextColumnHeaderToRead
=
0
;
Label_016A:
if
(
this
.HasMoreRows())
{
goto
Label_012E;
}
this
._haltRead
=
false
;
goto
Label_018E;
Label_017B:
if
(
this
.IsClosed)
{
throw
ADP.DataReaderClosed(
"
Read
"
);
}
Label_018E:
return
false
;
}
catch
(OutOfMemoryException exception3)
{
this
._isClosed
=
true
;
SqlConnection connection3
=
this
._connection;
if
(connection3
!=
null
)
{
connection3.Abort(exception3);
}
throw
;
}
catch
(StackOverflowException exception2)
{
this
._isClosed
=
true
;
SqlConnection connection2
=
this
._connection;
if
(connection2
!=
null
)
{
connection2.Abort(exception2);
}
throw
;
}
catch
(ThreadAbortException exception)
{
this
._isClosed
=
true
;
SqlConnection connection
=
this
._connection;
if
(connection
!=
null
)
{
connection.Abort(exception);
}
throw
;
}
finally
{
SqlStatistics.StopTimer(statistics);
Bid.ScopeLeave(
ref
ptr);
}
return
flag;
}
Reply
Answers (
1
)
I want to gengrate crystal report without add web reference
What is this error about