S
Scott M.
Does the DataTable.Load() method do its operation in one database round-trip
when it is passed a DataReader?
when it is passed a DataReader?
Scott M. said:Why would you see the connection opening and closing on the server during
a DataReader's read operations? Wouldn't it just stay open until .NET
asks for it to be closed?
"Wen Yuan Wang [MSFT]" said:Thanks for William and Cor's reply.
Hello Scott,
In my opinion, there is only one round-trip in Load method. If you use
profile to trace what happens on SQL server, I believe you won't find any
connection open/close event when loading.
But, on ado.net side, .net runtime get data from DB server by cache side
blocks.
The implement of Load method should be something like blow:
While (DataReader.read())
{Table.Rows[row][column]=DataReader.getFiled(int);}
Hope this helps. Please feel free to let me know if you have more
concern.
We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
Scott M. said:Why would you see the connection opening and closing on the server during
a DataReader's read operations? Wouldn't it just stay open until .NET
asks for it to be closed?
"Wen Yuan Wang [MSFT]" said:Thanks for William and Cor's reply.
Hello Scott,
In my opinion, there is only one round-trip in Load method. If you use
profile to trace what happens on SQL server, I believe you won't find any
connection open/close event when loading.
But, on ado.net side, .net runtime get data from DB server by cache side
blocks.
The implement of Load method should be something like blow:
While (DataReader.read())
{Table.Rows[row][column]=DataReader.getFiled(int);}
Hope this helps. Please feel free to let me know if you have more
concern.
We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
Scott M. said:Why would you see the connection opening and closing on the server during
a DataReader's read operations? Wouldn't it just stay open until .NET
asks for it to be closed?
"Wen Yuan Wang [MSFT]" said:Thanks for William and Cor's reply.
Hello Scott,
In my opinion, there is only one round-trip in Load method. If you use
profile to trace what happens on SQL server, I believe you won't find any
connection open/close event when loading.
But, on ado.net side, .net runtime get data from DB server by cache side
blocks.
The implement of Load method should be something like blow:
While (DataReader.read())
{Table.Rows[row][column]=DataReader.getFiled(int);}
Hope this helps. Please feel free to let me know if you have more
concern.
We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
William Vaughn said:If you're seeing Opens and Closes you're looking in the wrong place. When
the connection is closed, the server-side agent fetching the query rows is
taken out and shot and all of his possessions are given to the poor. A
DataReader needs an open connection for the entire fetch process. AFA the
Load operation, it's doing onsy Read calls to get the rows from the
client-side buffer. The underlying mechanism is retrieving rows in blocks
from the server-side agent that's fetching them in blocks. Yes, all of
this is transparent to the ADO.NET developer (as it should be).
Ah, what's the problem you're trying to solve? Performance? I've seen very
few problems solved by asking the question faster or by listening for the
answer faster. It's all in the question; the query. How long does it take
to run?
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
Scott M. said:Why would you see the connection opening and closing on the server during
a DataReader's read operations? Wouldn't it just stay open until .NET
asks for it to be closed?
"Wen Yuan Wang [MSFT]" said:Thanks for William and Cor's reply.
Hello Scott,
In my opinion, there is only one round-trip in Load method. If you use
profile to trace what happens on SQL server, I believe you won't find
any
connection open/close event when loading.
But, on ado.net side, .net runtime get data from DB server by cache side
blocks.
The implement of Load method should be something like blow:
While (DataReader.read())
{Table.Rows[row][column]=DataReader.getFiled(int);}
Hope this helps. Please feel free to let me know if you have more
concern.
We are glad to assist you.
Have a great day,
Best regards,
Wen Yuan
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.