Results 1 to 3 of 3

Thread: Help with Dataview needed..

  1. #1

    Thread Starter
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375

    Help with Dataview needed..

    Hi, I have a object which returns a populated DataSet object from an SQL database.

    I can populate a datagrid with all the information by binding the datagrid to the returned information; similiar to this (
    Code:
    Dim oDataSet as dataset
    
    ' Return a dataset from my object
    oDataSet = oMyObjectReference.MethodName("markj")
    
    ' Bind the retrieved dataset to a datagrid (dgStudentInfo is the name of the datagrid)
    dgStudentInfo.DataSource = oDataSet
    dgStudentInfo.DataBind()
    What I want to do then is filter the rows stored in the DataSet buy using a the filter method of a dataview
    I thought I could just go...

    Code:
    Dim oDataView As DataView
    oDataView = oDataSet.Tables("students").DefaultView
    When I run this I get an "System.NullReferenceException: Object reference not set to an instance of an object." on the following line;
    oDataView = oDataSet.Tables("students").DefaultView

    Its seems that I am trying to reference a NULL object..... Also is there a .NET equivalent of the isObject() function??

    Thanks for your help
    MarkusJ

  2. #2
    Addicted Member CoMMiE's Avatar
    Join Date
    Jul 2000
    Location
    Malaysia, Kuala Lumpur
    Posts
    179
    Hi
    Maybe you can try this

    Dim oDataView As New DataView
    oDataView = oDataSet.Tables("students").DefaultView

  3. #3

    Thread Starter
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Thanks for your help, I'll give it a try
    Regards
    Markusj

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width