|
-
Nov 20th, 2002, 07:15 AM
#1
Thread Starter
Lively Member
vb.net
Hi
this is the content displayed when tried to display field values in a database..
System.__ComObject.
But it is correctly looping thru records in the database
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As New ADODB.Connection()
Dim rs As New ADODB.Recordset()
Response.Write("Users")
cn.Open("Provider=SQLOLEDB.1;Persist Security Info=False;Initial Catalog=school;Data Source=192.168.0.1;User Id=sa;Password=secureops;")
rs.Open("usermaster", cn, 1, 3)
If Not rs.EOF Then
Do While Not rs.EOF
Try
Response.Write(rs("userid"))
Response.Write(rs("username"))
rs.MoveNext()
Catch
Response.Write("err in fields")
End Try
Loop
Else
Response.Write("No records")
End If
End Sub
-
Nov 20th, 2002, 09:54 AM
#2
Well problem number one is that you should be using ADO .NET in the System.Data namespace.. but to get what you got to work, I believe you need to specify the value propert of the rs object because VB .NET is not friendly about default properties
rs("myfield").Value
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|