Transfer ADO Code to ADO.NET

Discussion in 'ASP .Net' started by ronaldlee, Dec 17, 2004.

  1. ronaldlee

    ronaldlee Guest

    HI,
    how to do a RecordSet in OleDbConnection???
    my original code is using ADODB.RecordSet
    But how can i do the RecordSet in OleDbConnection?

    my original code

    Function openDB() As Object
    objConn = New ADODB.Connection
    objConn.Open(dbDNS) '("dbfile")

    objRS = New ADODB.Recordset

    End Function


    Function closeDB() As Object
    ' If the RecordSet has a state of 1 (open) close it
    If objRS.state = 1 Then
    objRS.Close()
    End If

    objConn.Close()
    objConn = Nothing
    End Function

    *-----------------------*
    Posted at:
    www.GroupSrv.com
    *-----------------------*
     
    ronaldlee, Dec 17, 2004
    #1
    1. Advertising

  2. This is really a bad way to do database operations in ASP.Net. Interop is
    problematic, and there are plenty of classes in the CLR for working with
    databases. I would suggest using them.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Neither a follower
    nor a lender be.

    "ronaldlee" <-spam.invalid> wrote in message
    news:41c2f45c$...
    > HI,
    > how to do a RecordSet in OleDbConnection???
    > my original code is using ADODB.RecordSet
    > But how can i do the RecordSet in OleDbConnection?
    >
    > my original code
    >
    > Function openDB() As Object
    > objConn = New ADODB.Connection
    > objConn.Open(dbDNS) '("dbfile")
    >
    > objRS = New ADODB.Recordset
    >
    > End Function
    >
    >
    > Function closeDB() As Object
    > ' If the RecordSet has a state of 1 (open) close it
    > If objRS.state = 1 Then
    > objRS.Close()
    > End If
    >
    > objConn.Close()
    > objConn = Nothing
    > End Function
    >
    > *-----------------------*
    > Posted at:
    > www.GroupSrv.com
    > *-----------------------*
     
    Kevin Spencer, Dec 17, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nita
    Replies:
    1
    Views:
    879
    Saravana
    Nov 20, 2004
  2. Replies:
    0
    Views:
    1,320
  3. Likhith Areekkal

    Need guidance - ADo .NET, ASP .NET, dataset - where does the code go?

    Likhith Areekkal, Dec 26, 2004, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    119
  4. Navin
    Replies:
    1
    Views:
    705
    Ken Schaefer
    Sep 9, 2003
  5. Jim
    Replies:
    1
    Views:
    907
    Aaron Bertrand - MVP
    Jan 28, 2004
Loading...

Share This Page