[RESOLVED] SQLCE problem with DELETE-VBForums
Results 1 to 4 of 4

Thread: [RESOLVED] SQLCE problem with DELETE

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    47

    Resolved [RESOLVED] SQLCE problem with DELETE

    HI!
    this is the code to delete a record
    Code:
    Code:
    Chiave = DirectCast(Bs.Current, DataRowView).Item("ID")
            MsgBox(Chiave)
            MsgBox("Sei sicuro di voler eliminare questo contatto? ", MsgBoxStyle.YesNo, "Attenzione!")
            If vbYes Then
                If Not Conn.State = ConnectionState.Open Then Conn.Open()
                sqL = "DELETE * FROM MiaTabella WHERE ID= " & Chiave
                Cmd = New SqlCeCommand(sqL, Conn)
                Cmd.ExecuteNonQuery()
                Da.Update(Ds, "MiaTabella")
                Ds.Reset()
                Da.Fill(Ds, "MiaTabella")
                Bs = New BindingSource(Ds, "MiaTabella")
                DatiDB()
            End If
    but this code that work on an other program (but in vb 10 and with Access)
    doesn't work !!!!!
    On Cmd.ExcuteNonQuery() give me this error
    Mistake during parsing the query. [ Token line number = 1,Token line offset = 8,Token in error = * ]
    How Could I resolve it ?
    Last edited by MThaste; Apr 9th, 2012 at 12:10 PM.

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,193

    Re: SQLCE problem with DELETE

    Have you tried using
    a
    Code:
    DELETE FROM
    instead of

    Code:
    DELETE * FROM
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  3. #3
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    3,055

    Re: SQLCE problem with DELETE

    You don't even need the From if you don't want it. This:-
    "DELETE MiaTabella WHERE ID= "
    would be fine.
    When one of my minions says, "Hey, he's just one guy, what can he do?" I say "This"... and shoot them.

    The problem with putting your lair in a volcano is keeping your robot army from melting.

    I know that the human being and the fish can coexist peacefully - George Bush

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2012
    Posts
    47

    Re: SQLCE problem with DELETE

    Quote Originally Posted by abhijit View Post
    Have you tried using
    a
    Code:
    DELETE FROM
    instead of

    Code:
    DELETE * FROM
    Quote Originally Posted by FunkyDexter View Post
    You don't even need the From if you don't want it. This:-
    "DELETE MiaTabella WHERE ID= "
    would be fine.
    Work Now I'm very happy thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.