Results 1 to 5 of 5

Thread: ADO

  1. #1
    Guest

    Arrow

    I hate it when people do this, but I need some help

    http://forums.vb-world.net/showthrea...threadid=30256

    nobody has answered yet.....
    Thanks....

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    I dont understand qhat you want..
    cant you explain the REAL thig you want whit a lot
    of exemples ??
    i'm realy tired..

  3. #3
    Guest
    I have 2 records in My DB, I want to add 1 at the end, how do I do this?

  4. #4
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208
    like the question I ask there :
    http://forums.vb-world.net/showthrea...threadid=30283
    ??????

  5. #5
    Junior Member
    Join Date
    Aug 2000
    Location
    Manila, Philippines
    Posts
    16
    Assuming you have an Access 97 database 'C:\MyDB.mdb',
    and that database has a table named 'MyTable' with the
    fields 'PageID' and 'Content', this is one way to do it:

    Dim cnn As ADODB.Connection
    Dim cmd As ADODB.Command
    Dim strConnect As String
    Dim strQuery As String

    Set cnn = New ADODB.Connection
    Set cmd = New ADODB.Command

    'Create the connection string.
    strConnect = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
    "Persist Security Info=False;Data Source=C:\MyDB.mdb"

    'Open a connection to the database.
    cnn.Open strConnect

    'Create the query string.
    strQuery = "insert into MyTable (PageID, Content) " & _
    "values ('Hello', 'hehehe')"

    'Create the insert query.
    Set cmd.ActiveConnection = cnn
    cmd.CommandType = adCmdText
    cmd.CommandText = strQuery

    'Execute the insert query.
    cmd.Execute

    'Close the connection to the database.
    cnn.Close

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