C
Chip Pearson
I'm sure I'm missing something simple, but I've hit a brick wall. I'm
creating an ASP.NET 2.0 web site in VS2005 (VB.NET) and need to read data
from an Access database without attaching it to any UI control. I've dropped
an AccessDataSource control named AccessGetDescription on my aspx page and
configured the data source with an SQL SELECT statement. Now, how in code
do I loop through the returned records? Here's what I have so far:
Dim IEnum As IEnumerable
Dim ThisFile As String
Dim ???? As ????
ThisFile = "Whatever.xls"
With Me.AccessGetDescription
.SelectCommandType = SqlDataSourceCommandType.Text
.SelectCommand = "SELECT Description FROM TableName WHERE FileName =
ThisFileName"
.SelectParameters.Add("ThisFileName", ThisFile)
IEnum = .Select(DataSourceSelectArguments.Empty)
For Each ???? In ????
MyDesc = ???.Fields("Description").ToString()
Next ???
End With
What goes after the .Select method and how are the variables declared to
loop through all the records? I'm used to ADO where you can do a
Do Until RecSet.EOF()
Debug.Print RecSet.Fields("Whatever").Value
RecSet.MoveNext
Loop
I can't get this to work in ASP.NET 2.0.
Any suggestions would be greatly appreciated. Thank you very much.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
creating an ASP.NET 2.0 web site in VS2005 (VB.NET) and need to read data
from an Access database without attaching it to any UI control. I've dropped
an AccessDataSource control named AccessGetDescription on my aspx page and
configured the data source with an SQL SELECT statement. Now, how in code
do I loop through the returned records? Here's what I have so far:
Dim IEnum As IEnumerable
Dim ThisFile As String
Dim ???? As ????
ThisFile = "Whatever.xls"
With Me.AccessGetDescription
.SelectCommandType = SqlDataSourceCommandType.Text
.SelectCommand = "SELECT Description FROM TableName WHERE FileName =
ThisFileName"
.SelectParameters.Add("ThisFileName", ThisFile)
IEnum = .Select(DataSourceSelectArguments.Empty)
For Each ???? In ????
MyDesc = ???.Fields("Description").ToString()
Next ???
End With
What goes after the .Select method and how are the variables declared to
loop through all the records? I'm used to ADO where you can do a
Do Until RecSet.EOF()
Debug.Print RecSet.Fields("Whatever").Value
RecSet.MoveNext
Loop
I can't get this to work in ASP.NET 2.0.
Any suggestions would be greatly appreciated. Thank you very much.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)