Results 1 to 3 of 3

Thread: update ado database

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    update ado database

    hello,i need help!

    1)how to immediately update recordset and perform the sql query i request?
    VB Code:
    1. Private Sub cmdtest_Click(Index As Integer)
    2. On Error Resume Next
    3.   With rs
    4.             .Fields("Location") = Txtlocation.Text
    5.             .Fields("DatePurchase") = DTPpurchase
    6.             .Fields("Item") = dcomboitem.Text
    7.             .Fields("Detail") = Txtitem2.Text
    8.             .Fields("IDNumber") = Txtidnumber.Text
    9.             .Fields("Price") = Txtprice.Text
    10.             .Fields("Status") = Combostatus.Text
    11.             .Fields("DateScrap") = DTPScrap
    12.             .Fields("Deletedate") = Txtdeldate.Text
    13.             Call clear
    14.         If MsgBox("are you sure want to update", vbOKCancel + vbExclamation, "update Record") = vbOK Then
    15.         .Update
    16.         Call display1
    17.     End If
    18.     End With
    19. end sub
    20.  
    21. Private Sub display1()
    22. Adodc1.ConnectionString = JetConnection
    23. Adodc1.Refresh
    24.  
    25.  Adodc1.RecordSource = "SELECT *from Inventory where Deletedate is Null"
    26.         Adodc1.Refresh
    27.  
    28. End Sub

    thanks!

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: update ado database

    Using data controls, you are at their mercy. I would suggest you use an ADO SQL Insert statement followed by a ADO SQL Select statement to get your data.

    Also why are you using On Error Resume Next. If there is an error you will attempt to get the data anyway and it wont be updated so how can you tell what went wrong?

    Remove it and work out the errors...

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    584

    Re: update ado database

    ok,i try now

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