![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
After an adapter is filled using "adapter".fill in vb.net, is the connection automatically closed after the method binds the dataset ??? Thanks |
#3
| |||
| |||
|
|
Hi, After you are finished with the connection, you should always close it. You close the connection using the Close method on the Connection property. Unlike in ADO, where you could wait until the Connection object went out of scope for the connection to be closed, in ADO.NET you should always explicitly close the connection. Calling Close() on the Connection will release the database connection back to the pool for some other procedure to reuse as soon as possible. HTH Mona "Tash" <Tash (AT) discussions (DOT) microsoft.com> wrote in message news:56BF9CAC-843B-414E-964D-1D2CD17B865F (AT) microsoft (DOT) com... After an adapter is filled using "adapter".fill in vb.net, is the connection automatically closed after the method binds the dataset ??? Thanks |
#4
| |||
| |||
|
|
But I'm not making a connection object. Dim usercnString As String = "data source=ffnynt03;initial catalog=FF_Directory;password=xxxxx;persist security info=False;user id=xxxxx;workstation id=RE_Proposed_Matter_Web;packet size=4096" strUserSQL = "Select (lastname + ', ' + firstname) as FullName from Directory where userLogin = '" + logon_user + "'" 'SQL Query to get logged on user full name. adapterUser = New SqlDataAdapter(strUserSQL, usercnString) dsUser = New DataSet adapterUser.Fill(dsUser, "User") And the adapterUser.fill method makes the connection automatically. Hence my question does that adapter.fill close the connection after it is binding the data to the dataset? Thanks, Tash "julia" wrote: Hi, After you are finished with the connection, you should always close it. You close the connection using the Close method on the Connection property. Unlike in ADO, where you could wait until the Connection object went out of scope for the connection to be closed, in ADO.NET you should always explicitly close the connection. Calling Close() on the Connection will release the database connection back to the pool for some other procedure to reuse as soon as possible. HTH Mona "Tash" <Tash (AT) discussions (DOT) microsoft.com> wrote in message news:56BF9CAC-843B-414E-964D-1D2CD17B865F (AT) microsoft (DOT) com... After an adapter is filled using "adapter".fill in vb.net, is the connection automatically closed after the method binds the dataset ??? Thanks |
#5
| |||
| |||
|
|
But I'm not making a connection object. Dim usercnString As String = "data source=ffnynt03;initial catalog=FF_Directory;password=xxxxx;persist security info=False;user id=xxxxx;workstation id=RE_Proposed_Matter_Web;packet size=4096" strUserSQL = "Select (lastname + ', ' + firstname) as FullName from Directory where userLogin = '" + logon_user + "'" 'SQL Query to get logged on user full name. adapterUser = New SqlDataAdapter(strUserSQL, usercnString) dsUser = New DataSet adapterUser.Fill(dsUser, "User") And the adapterUser.fill method makes the connection automatically. Hence my question does that adapter.fill close the connection after it is binding the data to the dataset? Thanks, Tash "julia" wrote: Hi, After you are finished with the connection, you should always close it. You close the connection using the Close method on the Connection property. Unlike in ADO, where you could wait until the Connection object went out of scope for the connection to be closed, in ADO.NET you should always explicitly close the connection. Calling Close() on the Connection will release the database connection back to the pool for some other procedure to reuse as soon as possible. HTH Mona "Tash" <Tash (AT) discussions (DOT) microsoft.com> wrote in message news:56BF9CAC-843B-414E-964D-1D2CD17B865F (AT) microsoft (DOT) com... After an adapter is filled using "adapter".fill in vb.net, is the connection automatically closed after the method binds the dataset ??? Thanks |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |