|
-
Dec 11th, 2006, 12:44 AM
#1
Thread Starter
Lively Member
[RESOLVED] Why cant sqlConnection and sqlDataAdapter variables be global ?
Hi,
When I tried to create a global variable of type sqlConnection and sqlDataAdapter, vb 2005 underlines it and says that the "type is not defined".
The 2 declarations are:
Dim myConnection As SqlConnection = New SqlConnection(..........)
Dim myAdapter As SqlDataAdapter = New SqlDataAdapter(......,....)
When they are added as global variables (outside of any private sub), vb 2005 highlights sqlConnection and sqlDataAdapter as errors. But when they are added inside a private sub procedure, like Private Sub Form1_Load, then there is no error.
How come they cant be global variables? I need them to be freely accessed by the various Private Sub procedure inside the Form1 public class.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|