Reputation: 177
I have this code so I can grab the values ind the dataset before i bind it. can't get the dirctcast to work
dim ds as new dataset("Mytable")
gridView.DataSource = ds
Dim dataRow As DataRowView = DirectCast(ds.Tables.Item("MyTable").Rows(), DataRowView)
Dim ID_Equipamento As String = dataRow("ID_Equipamento").ToString()
Dim ID_Password = dataRow("ID_Password").ToString()
Upvotes: 0
Views: 462
Reputation: 4201
Do not use VB, but will give it a go anyways;
ds.Tables.Item("MyTable").Rows() gives you a data row collection which is not a DataRowView.
Use this instead;
Dim dataRow As DataRow = ds.Tables.Item("MyTable").Rows().Item(0)
Also I see you call the dataset Mytable. A dataset is a container of datatables, so I recommend calling it MyDataSet. You then add a dataTable - for example MyTable.
Cheers!
Upvotes: 1