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,226

    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
    7,900

    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.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  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
  •  



Click Here to Expand Forum to Full Width