Jump to content

Problems with ado.net


Recommended Posts

this cauld is make troubles.Private dbread Private con As OdbcConnection Private comm As OdbcCommand 'function for opening connection and geting query result Function initConnection(ByVal sql As String) ' make sure every thing is closed On Error Resume Next comm = Nothing con.Close() con = Nothing On Error GoTo 0 'open the connection Dim conn As New Connections con = New OdbcConnection(conn.get_dsn()) con.Open() 'execute th sql and assign value to dbread comm = New OdbcCommand(sql, con) dbread = comm.ExecuteReader() Return dbread End Function 'function to close a connection that opened in previos function Function closeConnection() 'after using connection by the initconnection() function the 'closeconnection is the 'function that deal with closeing connection and odbcommand Try comm = Nothing 'set the odbcommand as nothing con.Close() 'close the odbconnections con = Nothing 'set the odbconnection as Nothing Catch ex As Exception End Try End Function '********************************************************************************

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...