Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Populating OleDbParameterCollection
Message
From
23/12/2005 08:48:09
Keith Payne
Technical Marketing Solutions
Florida, United States
 
 
To
23/12/2005 04:16:39
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01080445
Message ID:
01080473
Views:
21
>I have a class which starts like this:
>
>
>Imports System.Data.OleDb
>
>Public Class Data
>
>    Public oDataAdapter As OleDbDataAdapter
>    Public oDataSet As DataSet
>    Public oDataView As DataView
>    Public cSQL As String
>    Public cConnectionString As String
>    Public nCount As Integer
>    Public oParameters As OleDbParameterCollection
>
>
>To instantiate it, I do something like this:
>
>
>        Dim loDataProvider As Framework.Data = New Framework.Data
>
>
>Now, I need to add some parameters in the collection before doing something else. So, the instantiation code section now contains this:
>
>
>        Dim loDataProvider As Framework.Data = New Framework.Data
>        loDataProvider.oParameters.Add(New OleDbParameter("@Username", lcUsername))
>
>
>This doesn't give any error at design time. But, when I run it, I obtain:
>
>Object reference not set to an instance of an object
>
>Anyone would know what I have to adjust?

In the class definition, change Public oParameters As OleDbParameterCollection to Public oParameters As New OleDbParameterCollection.

Or change oParameters to a property and intialize it in the Get method.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform