CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Aug 2002
    Posts
    11

    Problems populating a manually created dataset via the XML Designer

    Hi,

    Using the VS.NET XML Designer I created a table that was to be used in a DataSet.
    The XML Designer created the DataSet class (dsMyDataSet) for me and I dropped in a new DataSet object and based it off my new DataSet class (dsMyDataSet) from the Toolbox into my form.
    Then in the form's code I typed the following:

    Try
    AdptAUSER.SelectCommand.Parameters(0).Value = m_sUserID
    AdptAUSER.Fill(dsMyDataSet)
    Conn.Close()
    Catch ex As Exception
    MsgBox(ex.ToString)
    Finally
    End Try

    Dim md As Integer
    md = dsMyDataSet.Users.Rows.Count
    etc.

    m_sUserID is a string and parameter zero (0) is also defined as a string.
    The problem is that the dataset isn't getting populated with any values. The count function returns zero rows.

    However, if I use the same code, but instead declare a new DataSet, everything is fine. For example:

    Dim dsTemp as DataSet()
    Try
    AdptAUSER.SelectCommand.Parameters(0).Value = m_sUserID
    AdptAUSER.Fill(dsTemp)
    Conn.Close()
    Catch ex As Exception
    MsgBox(ex.ToString)
    Finally
    End Try

    Dim md As Integer
    md = dsTemp.Tables(0).Rows.Count
    etc.

    When I run the above code, I get what I expect; a single record.
    So, what could I be doing wrong in the first scenario that would cause it to not populate or return any data?

    Thanks

    Jonez

    Addedum:
    The DataSet in the first scenario is a typed dataset.
    Last edited by Jonez; November 8th, 2002 at 04:55 PM.

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

Featured