Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataView returned object problem
Message
From
06/12/2005 16:16:45
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
06/12/2005 15:56:29
General information
Forum:
ASP.NET
Category:
Migration
Miscellaneous
Thread ID:
01075482
Message ID:
01075488
Views:
18
This message has been marked as the solution to the initial question of the thread.
>I am having a problem on the last line of the following code since I migrated to VS 2005:
>
>
>Imports System.Data.OleDb
>
>Public Class Data
>
>    Inherits ErrorHandler
>
>    ' SQL adapter into a DataView
>    ' expC1 SQL command
>    ' expC2 Path of the table
>    Public Shared Function VFPSQLAdapterDataView(ByVal tcSQL As String, ByVal tcTable As String) As DataView
>        Dim loData As DataSet
>        Dim loView As DataView
>        ErrorInitialize()
>        loData = New DataSet
>        Try
>            Dim loDT As New OleDbDataAdapter(tcSQL, _
>            "Provider=VFPOLEDB.1;Data Source=" + tcTable + ";Password='';Collating Sequence=MACHINE")
>
>            loDT.Fill(loData, "Temp")
>
>            ' Get it into a view
>            loView = loData.Tables("Temp").DefaultView
>
>        Catch loError As Exception
>            ErrorSetup(loError)
>        End Try
>
>        Return loView
>    End Function
>
>
>In the compiler, I also have something like:
>
>Variable 'loView' is used before it has been assigned a value. A null reference exception could result at runtime.

Michel,

Change
Dim loView As DataView
to
Dim loView As DataView = Nothing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform