|
-
Oct 15th, 2004, 08:15 AM
#1
Thread Starter
Fanatic Member
Newbie -> System.NullReferenceException
When running below codes, I met the following error message
An unhandled exception of type 'System.NullReferenceException' occurred in NetAdmin.exe
Additional information: Object reference not set to an instance of an object.
Private Sub LoadRemoteHost()
Dim SQLDA1 As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
'
SQLDA1.SelectCommand.Connection = SQLConn0
SQLDA1.SelectCommand.CommandType = CommandType.StoredProcedure
SQLDA1.SelectCommand.CommandText = "usp_showremotehost"
dataset.Clear()
SQLDA1.Fill(dataset)
Me.C1TrueDBGrid1.DataSource = dataset.Tables("RemoteHost")
End Sub
Am I missing something? .. please advise ..many thanks in advance
Regards
Winan
-
Oct 15th, 2004, 08:18 AM
#2
it means an object you are using has been declared, but hasn't been set to anything yet...
where does the var SQLConn0 come from?
-
Oct 15th, 2004, 10:11 AM
#3
Thread Starter
Fanatic Member
RESOLVED
Thanks the problem has been resolved .. by running below codes:
Dim SQLDataAdapter As New SqlClient.SqlDataAdapter("usp_showremotehost", SQLConn0)
Dim DSRemoteHost As New DataSet("RemoteHost")
SQLDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
DSRemoteHost.Clear()
SQLDataAdapter.Fill(DSRemoteHost, "RemoteHost")
..
..
..
SQLConn0 declared as public variable in a module
Regards
Winan
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
|