Advertisement

03.21.2008 at 12:51PM PDT, ID: 23260495
[x]
Attachment Details

Variable 'dataRS' is used before it has been assigned a value.  A null reference exception could result at runtime.

Asked by trsc6350 in .NET Framework 2.0, Programming for ASP.NET, Visual Studio .NET 2005

Tags: Visual Studio 2005 ASP.NET using Vb.net

Can you assist me in eliminating this warning?  I am getting a runtime error for certain groups when I am logged into the published application with certain permissions.  When I am in visual studio 2005, I have no errors, I only have one warning: "Variable 'dataRS' is used before it has been assigned a value.  A null reference exception could result at runtime.  This is the message I am getting from the published application:
Server Error in '/Assessment' Application.

--------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

 
<!-- Web.Config Configuration File -->
 
<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
 


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

 
<!-- Web.Config Configuration File -->
 
<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>
 
Anything input you can provide is greatly welecomed.  Thank you in advance.  Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
' <summary>
    ' Generic function for populating the dropdown list.
    ' </summary>
    Public Function FillParameterDDL(ByRef ddList As DropDownList, _
                                     ByVal ddListName As String, _
                                     ByVal parameterValue As String, _
                                     ByVal currentValue As String) As Boolean
 
        Dim dataRS As DataSet
        Dim insertEmptyOption As Boolean
 
        Select Case ddListName
            Case "Evaluation Month"
                dataRS = DA_Assessment.GetEvaluationMonthList(parameterValue)
                insertEmptyOption = True
            Case "Support Area"
                Dim periodId As Integer = Split(parameterValue, "_")(0)
                Dim evaluationMonth As Integer = Split(parameterValue, "_")(1)
                dataRS = DA_Assessment.GetSupportAreaList(CInt(periodId), CInt(evaluationMonth))
                insertEmptyOption = True
            Case "Response"
                dataRS = DA_Assessment.GetResponseList(CInt(parameterValue))
                insertEmptyOption = False
        End Select
[+][-]03.21.2008 at 01:05PM PDT, ID: 21182739

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.21.2008 at 01:57PM PDT, ID: 21183121

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.22.2008 at 02:14AM PDT, ID: 21185384

View this solution now by starting your 7-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

Zones: .NET Framework 2.0, Programming for ASP.NET, Visual Studio .NET 2005
Tags: Visual Studio 2005 ASP.NET using Vb.net
Sign Up Now!
Solution Provided By: renjurdevan
Participating Experts: 3
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628