Cassio
Junior Contributor
Hi, I´d like to know if theres any diference between these two aproaches:
1.
2.
I guess theres no diference, since I instanciate the cn object inside the procedures, right?
Thanks.
1.
Visual Basic:
Private cn as SQLConnection
Private Sub Sub1()
cn = New SQLConnection(connectionstring)
'Code here
cn.close
End Sub
Private Sub Sub2()
cn = New SQLConnection(connectionstring)
'Code here
cn.close
End Sub
2.
Visual Basic:
Private Sub Sub1()
Dim cn as SQLConnection
cn = New SQLConnection(connectionstring)
'Code here
cn.close
End Sub
Private Sub Sub2()
Dim cn as SQLConnection
cn = New SQLConnection(connectionstring)
'Code here
cn.close
End Sub
I guess theres no diference, since I instanciate the cn object inside the procedures, right?
Thanks.