Results 1 to 5 of 5

Thread: how to translate VB6.0 ADO to .net

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455

    how to translate VB6.0 ADO to .net

    Dear VB users,

    Is there someone who can translate the next source to .net?
    Wich references do we need to choose?

    Set DB = New Connection
    DB.Open “connection to sql or mdb”

    Set AdoSet = New Recordset
    SqlStr = "SELECT * FROM tblMine'"
    AdoSet.Open SqlStr, DB

    If Not AdoSet.EOF Then
    ‘. . . . . . . . . .
    End If

    Thanks for reading,

    Michelle
    Last edited by michelle; Jun 3rd, 2004 at 08:03 AM.

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Here is some code on doing what you want to do, but you may want to do some more reading on the new OleDb stuff in .net so you can make the best use of the new functionality.
    VB Code:
    1. Dim objConn as OleDb.OleDbConnection
    2. 'Set our connection string
    3.         sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    4.    "Data Source=dbpath;" & _
    5.    "User Id=admin;" & _
    6.    "Password="
    7.  
    8.  
    9.         'Create the connection
    10.         objConn = New OleDb.OleDbConnection(sConn)
    11.         objConn.Open()
    12.  
    13.     dim objCommand as OleDb.OleDbCommand
    14.     dim objRS as oleDB.oleDbDataReader
    15.         objCommand = objConn.CreateCommand
    16.         objCommand.CommandText = "SELECT * FROM TABLE"
    17.         objCommand.Connection = oConn.objConn
    18.         objRS = objCommand.ExecuteReader()
    19.  
    20.         While objRS.Read
    21.     wend

  3. #3
    Hyperactive Member
    Join Date
    Mar 2004
    Location
    Prato - Tuscany - Italy
    Posts
    461
    I'm the only man on this world who uses VB.NET and ADO (not ADO.NET)
    I know that ADO.NET can be useful if you need to work disconnected, but if you want to work on a little LAN or a single computer, you can also choose to keep ADO. I choosed ADO because I wanted to use pessimistich locking that ADO.NET doesn't offer. My suggestion: If you really need to use ADO.NET jump on it, but if you don't you can still work with ADO in the same way you did in VB6. Good job!
    Live long and prosper (Mr. Spock)

  4. #4
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188

    VB.NET and ADO (not .NET)

    How exactly do I take advantage of ADO the old way? I am having trouble finding examples.

    Thank you.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I think its as simple as setting a reference to MSADO**.DLL in your project, and then using it the same way.

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