M
mschmidt18
Hi, I am writing my first web app in VB.Net, after being very familiar
with C#.Net. I am trying to store the results of the
SqlDataSource.Select() method. In C#, the select method returns a
DataView, which you can manipulate very easily. But I have not had
success using the same method in VB. I did have success using
Enumerators, but i would like to work with the data in a DataTable.
here is some of my code:
in C#:
DataView dv = (DataView)
sdsDataSource.Select(DataSourceSelectArguments.Empty);
int count = dv.Table.Rows.Count();
...... whatever else
in VB, i got this to work
Dim ie As IEnumerable
ie = sdsDataSource.Select(DataSourceSelectArguments.Empty)
Dim dt As IEnumerator = ie.GetEnumerator()
while dt.MoveNext()
Dim dr As System.Data.DataRowView = dt.Current()
Response.Write(dr(0).ToString())
....whatever else
end while
Is it possible to cast an IEnumberable as a DataView or DataTable? I
really want to be able to count the number of rows, and work with the
data in a DataTable.
Thanks!
with C#.Net. I am trying to store the results of the
SqlDataSource.Select() method. In C#, the select method returns a
DataView, which you can manipulate very easily. But I have not had
success using the same method in VB. I did have success using
Enumerators, but i would like to work with the data in a DataTable.
here is some of my code:
in C#:
DataView dv = (DataView)
sdsDataSource.Select(DataSourceSelectArguments.Empty);
int count = dv.Table.Rows.Count();
...... whatever else
in VB, i got this to work
Dim ie As IEnumerable
ie = sdsDataSource.Select(DataSourceSelectArguments.Empty)
Dim dt As IEnumerator = ie.GetEnumerator()
while dt.MoveNext()
Dim dr As System.Data.DataRowView = dt.Current()
Response.Write(dr(0).ToString())
....whatever else
end while
Is it possible to cast an IEnumberable as a DataView or DataTable? I
really want to be able to count the number of rows, and work with the
data in a DataTable.
Thanks!