ado .net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Terry Knight

    #1

    ado .net

    Hello,

    I'm new to ADO .NET and I'm still thinking back to ADO in VB6 using
    recordset. Now I have added the ADODB reference so I can still use if for
    some of the program that I'm programming but I would like to get into ADO
    ..NET.

    Here's my question. In VB6 you could call a single field:

    textbox = rs("field")

    can you do this in ADO .net???

    Now I know about the FILL function for ADO .net but there's a couple things
    that I'd like to do but just using 1 or 2 of the fields not all of them.

    ---------------------------------------------
    Terry Knight
    Computer Systems Technologist
    F: 206.260.0704



  • Kirk

    #2
    ado .net

    Terry,

    ADO.net actually has 2 object that 'replace' the
    functionality of the recordset. The first option is the
    one I think you have mentioned, the DataAdapter. Using the
    DataAdapter you can fill a dataset with the result from a
    query (data is all loaded Client side in a single step).
    The other option is the DataReader. You can use the
    DataReader to do the same sort of record by record loop
    that the adodb.recordset allowed.

    a brief sample (in vb.net):
    *************** ***********
    dim cmd as new SQLClient.SQLCo mmand
    (SomeSQLString, SomeConnecion)
    dim dr as SQLClient.SQLDa taReader

    dr = cmd.executeRead er

    do while dr.read()
    ' right here you can place the data into your textboxes
    or whatever
    textbox1.text = dr.item("fieldN ame")
    loop

    dr.close
    *************** ***********
    Unlike the recordset, be careful to ALWAYS close your
    datareader. It locks up the connection until you do.

    Kirk
    [color=blue]
    >-----Original Message-----
    >Hello,
    >
    >I'm new to ADO .NET and I'm still thinking back to ADO in[/color]
    VB6 using[color=blue]
    >recordset. Now I have added the ADODB reference so I can[/color]
    still use if for[color=blue]
    >some of the program that I'm programming but I would like[/color]
    to get into ADO[color=blue]
    >..NET.
    >
    >Here's my question. In VB6 you could call a single field:
    >
    >textbox = rs("field")
    >
    >can you do this in ADO .net???
    >
    >Now I know about the FILL function for ADO .net but[/color]
    there's a couple things[color=blue]
    >that I'd like to do but just using 1 or 2 of the fields[/color]
    not all of them.[color=blue]
    >
    >---------------------------------------------
    >Terry Knight
    >Computer Systems Technologist
    >F: 206.260.0704
    >www.tforce.ca
    >
    >
    >.
    >[/color]

    Comment

    • savy

      #3
      ado .net

      better off using vb6 to work with databases. It's all
      chingered up in .net.

      Comment

      Working...