VB6 help anyone please??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nit
    New Member
    • Mar 2006
    • 1

    VB6 help anyone please??

    (i'm totally clueless when it comes to vb) i'm getting "compile error invalid use of property"
    with the error
    [CODE=vb]
    Private Sub cmdDelete_Click () (at here)
    Dim db1 As ADODB.Command
    db1 = New ADODB.Command
    db1.ActiveConne ctio n = "A:\db1.mdb "
    db1.CommandType = adCmdText
    db1.CommandText = "delete * from order where orderid=" & txtOrder.Text
    db1.Execute
    End With
    End Sub
    [/CODE]
    all i am trying to is is when i enter in a order id (shown in the pic) and click on delete it goes into the database find the id and the row of information and deletes it and i'm getting nowhere with the code , if i've gone totally from can some explain to me how i could do this please?

    Last edited by Killer42; Apr 21 '08, 07:11 AM. Reason: Added CODE=vb tag
  • hackman
    Banned
    New Member
    • Apr 2008
    • 3

    #2
    Originally posted by nit
    (i'm totally clueless when it comes to vb) i'm getting "compile error invalid use of property"
    with the error

    Private Sub cmdDelete_Click () (at here)



    all i am trying to is is when i enter in a order id (shown in the pic) and click on delete it goes into the database find the id and the row of information and deletes it and i'm getting nowhere with the code , if i've gone totally from can some explain to me how i could do this please?

    [IMG]http://img95
    .imageshack.us/img95/3931/pic9md.th.jpg[/IMG]
    Dim db1 As ADODB.Command
    db1 = New ADODB.Command
    db1.ActiveConne ctio n = "A:\db1.mdb "
    db1.CommandType = adCmdText
    db1.CommandText = "delete * from order where orderid=" & txtOrder.Text
    db1.Execute
    End With
    End Sub

    I don't know but like me i think the error is in the commandtype because on my compyter the error is in the command type change the command type and you will see how this work(Change the command type with a "acCmdText" )!!!



    (((HACKER)))

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      You need to create a connection object and the same connection must be opened before doing any operation on database .

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Which line produces the error, anyway?

        Oh, and by the way - won't that End With produce an error? There's no With statement.

        Comment

        Working...