Click to See Complete Forum and Search --> : Problems populating a manually created dataset via the XML Designer


Jonez
November 8th, 2002, 03:45 PM
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.