[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

Using Profile in a Public class

Asked by mpdillon in Visual Studio

Tags: Microsoft, Visual Studio 2008, Visual studio 2008

When I try to use a value stored in the Profile in a public class I receive the following error message.

?currentProfile.DBServerIP15string
A first chance exception of type 'System.Configuration.SettingsPropertyNotFoundException' occurred in System.dll

Previously I asked how to access the Profile values in a public class. It was answered. That solution had me add.
Dim currentProfile as new ProfileCommon to each of the subroutines in the public class.

It is working. There is a subroutine which assigns the values to all of the properties in my Profile. This works fine.

It is later after opening several other pages that the problem occurs. When the page Load event fires the Profile.DBServerIP15String does contain a value. The next line in the page load event calls the Public class. I dimensioned the variable currentProfile just as I did earlier when I assigned values to my Profile. But this second time is when I get the error.

What am I doing wrong?

The Profile variables are defined in the web.config and stored in Sql 2005.

Page Load event
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
'AT THIS POINT PROFILE.DBSERVERIP15STRING CONTAINS A VALUE
            LogInCtl.PopulateStateDropDownList(Me.StateDropDownList1)
            DataCtl.PopulateCountryCodes(Me.CountryDropDownList1)
            LoadAdminInfo()
        Else

        End If
    End Sub

The subroutine in the Public Class LOGINCTL

Public Shared Sub PopulateStateDropDownList(ByRef objDDL As DropDownList)
        Dim AdminConnSqlConnection As New System.Data.SqlClient.SqlConnection
        Dim Dr1SqlDataReader As System.Data.SqlClient.SqlDataReader
        Dim Dr1SqlCommand As New System.Data.SqlClient.SqlCommand
        Dim Parmstring As String
        Dim strStateCode As String
        Dim strStateName As String
        Dim currentProfile As New ProfileCommon
'AT THIS POINT currentProfile.DBServerIP15String HAS NOT BEEN ASSIGNED A VALUE. WHY?????
        Parmstring = "Server=" & currentProfile.DBServerIP15string.Trim & "\" & currentProfile.ServerSqlInstanceName20string & _
        "; Database=Admin01; User ID=" & currentProfile.DBUserName15string.Trim & "; Password=" & currentProfile.DBPassword15string.Trim

      end sub

[+][-]05/08/08 06:26 AM, ID: 21524404Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Visual Studio
Tags: Microsoft, Visual Studio 2008, Visual studio 2008
Sign Up Now!
Solution Provided By: mpdillon
Participating Experts: 0
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-92 / EE_QW_2_20070628