I'm trying to connect to a SQL 6.5 database. I get build errors on the following line: For Each dr In dsname.Tables(0)
The error is: Expression is of type 'System.Data.DataTable', which is not a collection type.
Forgive me if this is a simple problem, I'm new to ASP.NET.
Here's my code:
The error is: Expression is of type 'System.Data.DataTable', which is not a collection type.
Forgive me if this is a simple problem, I'm new to ASP.NET.
Here's my code:
Code:
Dim db As String
db = Request.QueryString("dbname")
'Response.Write(db)
Dim strconnection As String = "Driver={SQL Server};" & _
"Server=xxxxxxxx;" & _
"Database=" & db & ";" & _
"Uid=xxxxxx;" & _
"Pwd=xxxxxx"
Dim odbcconn As New OdbcConnection(strconnection)
Dim daname As New OdbcDataAdapter("select * from tblemployee where logindatetime > 'Jan 1 1950 8:00AM'", odbcconn)
Dim dsname As DataSet
daname.Fill(dsname, "tblemployee")
Dim dr As DataRow
For Each dr In dsname.Tables(0)
Response.Write("<a href=name.aspx?name=" & dr.Item(0) & ">" & dr.Item(0) & "</a><br>")
Next