Groups | Blog | Home
all groups > dotnet windows forms databinding > march 2005 >

dotnet windows forms databinding : sqlDataAdapter, SQl Server - why two connections


Adam
3/3/2005 9:27:03 AM
I have built a very simple single form Application, with a sqlDataAdapter,
sqlConnection, dataSet and a Grid. As soon as I load the application and bind
the data there are two connections from my App in SQL Server.

Can anyoone explain why this is, and if this means my App will take up two
licenced connections to the Server, or one?

Thanks
--
v-jetan NO[at]SPAM online.microsoft.com (
3/4/2005 5:54:19 AM
Hi Adam,

Thanks for your posting!!

Yes, I have reproduced out your issue on my side.
Actually, this behavior is by design, if we do not use SqlDataAdapter.Fill
method, but use SqlConnection.Open method, we will only find one connection
in the Sql Server Enterprise Manager, while SqlDataAdapter.Fill method will
cause 2 connections openned.

SqlDataAdapter.Fill method may first open the DataBase for schema query,
then a second database open for real data reading. I think this is the
default and internal behavior of SqlDataAdapter.Fill method, which we
should just ignore.

At last, it seems that this issue is more related to ADO.net and Sql Server
than Windows Form Databinding, I suggest you post in .Net ADO.net newsgroup
for better response and more professional support. Hope this helps.
=============================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
AddThis Social Bookmark Button