Results 1 to 2 of 2

Thread: vb.net

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    chennai
    Posts
    90

    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
    akalya

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width