sub Application_OnStart(sender As Object, e As EventArgs)
Dim objConn as New OleDbConnection()
objConn.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
Application("yourdblink")=objConn
Application("yourdblink").Open()
end sub
sub Application_OnEnd(sender As Object, e As EventArgs)
Application("yourdblink").close()
Application("yourdblink")=nothing
end sub
sub Session_OnStart(sender As Object, e As EventArgs)
end sub
sub Session_OnEnd(sender As Object, e As EventArgs)
end sub
</script>
在调用oledbconnection对象的时候这样实现:
dim MyComm as OleDbCommand = new OleDbCommand(strsql,Application("yourdblink"))
dim dr as OleDbDataReader = MyComm.ExecuteReader()
'做后别忘了
dr.Close()
dr = nothing