1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strConnection as String = "user id=sa;password=toto;"
strConnection += "database=MSIDB;server=Myserver;"
strConnection += "Connect Timeout=30"
Dim Conn as New SqlConnection ( strConnection )
Conn.Open ()
'Mes requetes'
Conn.Close
end sub
sub Mafonction1 (ByVal sender As Object, ByVal e As System.EventArgs)
'Si je dois attaquer encore la base je redeclare une connexion'
Dim strConnection as String = "user id=sa;password=toto;"
strConnection += "database=MSIDB;server=Myserver;"
strConnection += "Connect Timeout=30"
Dim Conn1 as New SqlConnection ( strConnection )
Conn1.Open ()
'Mes requetes'
Conn1.Close
end sub |
Partager