Do not close the serious consequences of data connection

xiaoxiao2021-03-06  107

Made a DataGrid, to press twice to display the deleted result on the screen, for two days, check it to know that the data connection is not closed below: Public overloads Shared Sub DelRecord (Byval Myid AS Integer) DIM myconnection As New OleDbConnection (CommunityGlobals.ConnectionString) Dim mycommand As OleDbCommand = New OleDbCommand ( "delete from articles where id =" & myid, myconnection) myconnection.Open () mycommand.ExecuteNonQuery () 'myconnection.Close () End Sub the following are right: Public Overloads Shared Sub delrecord (ByVal myid As Integer) Dim myconnection As New OleDbConnection (CommunityGlobals.ConnectionString) Dim mycommand As OleDbCommand = New OleDbCommand ( "delete from articles where id =" & myid, myconnection) myconnection.Open () MyCommand.executenonQuery () MyConnection.close () end sub

转载请注明原文地址:https://www.9cbs.com/read-102542.html

New Post(0)