Error setting Profile

partha.majumdar

Active member
Joined
Aug 13, 2006
Messages
33
Location
Kolkata
Programming Experience
10+
Dear Sir/Madam,

I am trying to use OracleProfileProvider. Now, I have initialised all variables. Yet it is giving a NullValueException at the point of setting the profile value. When I debug, I can see that all the variables are initialised. The error line is marked in bold.

Thanks,
Partha


Dim lobjProfileProvider As OracleProfileProvider = Nothing
Dim lobjParameters As System.Collections.Specialized.NameValueCollection = Nothing
Dim lobjSettingContext As System.Configuration.SettingsContext = Nothing
Dim lobjSettingPropertyValueCollection As System.Configuration.SettingsPropertyValueCollection = Nothing
Dim lobjSettingPropertyValue As System.Configuration.SettingsPropertyValue = Nothing
Dim lobjSettingProperty As System.Configuration.SettingsProperty = Nothing
Dim lobjSettingPropertyCollection As System.Configuration.SettingsPropertyCollection = Nothing

lobjProfileProvider = New OracleProfileProvider()
lobjParameters = New System.Collections.Specialized.NameValueCollection()
lobjParameters.Add("connectionStringName", "OracleDataProvider")
lobjProfileProvider.Initialize("NewOracleProfileProvider", lobjParameters)

lobjSettingContext = New System.Configuration.SettingsContext()
lobjSettingContext.Add("Team", GetType(String))

lobjSettingProperty = New System.Configuration.SettingsProperty("Team")
lobjSettingProperty.PropertyType = GetType(String)
'lobjSettingProperty.Provider

lobjSettingPropertyValue = New System.Configuration.SettingsPropertyValue(lobjSettingProperty)
lobjSettingPropertyValue.PropertyValue = ddlTeam.SelectedValue

lobjSettingPropertyValueCollection = New System.Configuration.SettingsPropertyValueCollection()
lobjSettingPropertyValueCollection.Add(lobjSettingPropertyValue)

lobjProfileProvider.SetPropertyValues(lobjSettingContext, lobjSettingPropertyValueCollection)

lobjSettingPropertyCollection = New System.Configuration.SettingsPropertyCollection()
lobjSettingPropertyCollection.Add(lobjSettingProperty)
Dim x = lobjProfileProvider.GetPropertyValues(lobjSettingContext, lobjSettingPropertyCollection)
 
Back
Top