Value cannot be null

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul

    Value cannot be null

    Hi,

    I'm new to .NET and I'm trying to run through the tutorial
    "Creating a Web Application Using VB"

    As I follow the directions, It seems to work just fine.

    I can preview the data from the SQLDataAdapter but when I
    try to view the data in the browser I get the error:


    Value cannot be null. Parameter name: dataSet
    Description: An unhandled exception occurred during the
    execution of the current web request. Please review the
    stack trace for more information about the error and
    where it originated in the code.

    Exception Details: System.Argument NullException: Value
    cannot be null. Parameter name: dataSet

    Source Error:

    Line 2: Inherits System.Componen tModel.Componen t
    Line 3: Public Sub FillDataSet(ByV al dSet As
    myDataSet)
    Line 4: SqlDataAdapter1 .Fill(dSet)
    Line 5: End Sub
    Line 6: #Region " Component Designer generated code "

    Any help would be appreciated. thx.

    Paul
    801.366.0224
    ptoyn@yahoo.com
  • Guy Bradley

    #2
    Re: Value cannot be null

    > Exception Details: System.Argument NullException: Value[color=blue]
    > cannot be null. Parameter name: dataSet
    >
    > Source Error:
    >
    > Line 2: Inherits System.Componen tModel.Componen t
    > Line 3: Public Sub FillDataSet(ByV al dSet As
    > myDataSet)
    > Line 4: SqlDataAdapter1 .Fill(dSet)
    > Line 5: End Sub
    > Line 6: #Region " Component Designer generated code "[/color]

    The error message means that you have not instantiated the dataset object
    you are trying to fill

    Dim dSet as new Dataset.

    Public Sub FillDataSet(ByV al dSet)
    SqlDataAdapter1 .Fill(dSet)
    End Sub


    Comment

    • Guest's Avatar

      #3
      Re: Value cannot be null

      Thanks for a quick reply; howerver,

      doens't line 3 below instantiate the dataset?
      [color=blue]
      >-----Original Message-----[color=green]
      >> Exception Details: System.Argument NullException: Value
      >> cannot be null. Parameter name: dataSet
      >>
      >> Source Error:
      >>
      >> Line 2: Inherits System.Componen tModel.Componen t
      >> Line 3: Public Sub FillDataSet(ByV al dSet As
      >> myDataSet)
      >> Line 4: SqlDataAdapter1 .Fill(dSet)
      >> Line 5: End Sub
      >> Line 6: #Region " Component Designer generated code "[/color]
      >
      >The error message means that you have not instantiated[/color]
      the dataset object[color=blue]
      >you are trying to fill
      >
      >Dim dSet as new Dataset.
      >
      >Public Sub FillDataSet(ByV al dSet)
      > SqlDataAdapter1 .Fill(dSet)
      >End Sub
      >
      >
      >.
      >[/color]

      Comment

      • William Ryan eMVP

        #4
        Re: Value cannot be null

        Nothing in this code Instantiates a dataset. If the calling code passed in
        an Instantiated dataset, it would be ok. what does the caller look like?
        before you pass in the dataset do you create a new Datasst

        Dim myDS as New DataSet?
        <anonymous@disc ussions.microso ft.com> wrote in message
        news:58c101c42d 41$71a9bcd0$a50 1280a@phx.gbl.. .[color=blue]
        > Thanks for a quick reply; howerver,
        >
        > doens't line 3 below instantiate the dataset?
        >[color=green]
        > >-----Original Message-----[color=darkred]
        > >> Exception Details: System.Argument NullException: Value
        > >> cannot be null. Parameter name: dataSet
        > >>
        > >> Source Error:
        > >>
        > >> Line 2: Inherits System.Componen tModel.Componen t
        > >> Line 3: Public Sub FillDataSet(ByV al dSet As
        > >> myDataSet)
        > >> Line 4: SqlDataAdapter1 .Fill(dSet)
        > >> Line 5: End Sub
        > >> Line 6: #Region " Component Designer generated code "[/color]
        > >
        > >The error message means that you have not instantiated[/color]
        > the dataset object[color=green]
        > >you are trying to fill
        > >
        > >Dim dSet as new Dataset.
        > >
        > >Public Sub FillDataSet(ByV al dSet)
        > > SqlDataAdapter1 .Fill(dSet)
        > >End Sub
        > >
        > >
        > >.
        > >[/color][/color]


        Comment

        Working...