CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2001
    Location
    Los Angeles, CA, United States
    Posts
    47

    Delete SQL statement

    There occurs in delete sql.
    sql statement is like following.
    --------------------------------------------------
    cmd.CommandText = "Delete * from sampletbl WHERE (Id='" & vId & "' AND date = '" & vDate & "' AND seq = '" & vSeq & "')"
    --------------------------------------------------
    vId, vDate, vSeq are variables.
    I don't know what's the problem.
    Could anyone who know about SQL let me know?
    I'm sorry I might asked so basic question.

    Programmer.
    Multimedia/Image Processing/FA/CADCAM
    C,V/B,V/C++

  2. #2
    Join Date
    May 2001
    Location
    Canada
    Posts
    182

    Re: Delete SQL statement

    Change 'Delete * from ' to 'Delete from'

    Regards,

    Michi

  3. #3
    Join Date
    Sep 2001
    Location
    Montreal Canada
    Posts
    1,080

    Re: Delete SQL statement

    When you use a date field don't use it as a string if it is of type date in your database.

    ' AND date = '" & vDate & "' this won't work

    Use # instead of '

    "' AND date =#" & vDate &"#

    this should work



    Nicolas Bohemier

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

Featured