Announcement

Collapse
No announcement yet.

syntax error in update statement

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • syntax error in update statement

    facing issue on update statement, I'm using vb.net


    update a set amount=112,paidstatus='No' ,paiddate='11/16/2013',action='No', addedon= Now() where id=1

    error as : syntax error in update statement

    find attached table structure
    id autonumber
    name text
    exp text
    amt number
    dt date/time
    status text
    pdt date/time
    action text
    added date/time



    Thanks for help

  • #2
    Originally posted by kirank View Post
    facing issue on update statement, I'm using vb.net


    update a set amount=112,paidstatus='No' ,paiddate='11/16/2013',action='No', addedon= Now() where id=1

    error as : syntax error in update statement

    find attached table structure
    id autonumber
    name text
    exp text
    amt number
    dt date/time
    status text
    pdt date/time
    action text
    added date/time



    Thanks for help
    '

    any help?

    Comment


    • #3
      I don't see a syntax error unless it is complaining on your table name "a"
      Have a Script or Snippet you want to share?

      WWW Standards: HTML 4.01,
      HTML 5, CSS2.1, CSS3, XHTML 1.0
      PHP Standards: PHP Standards

      Comment


      • #4
        Originally posted by scoutt View Post
        I don't see a syntax error unless it is complaining on your table name "a"
        yes correct!! i just change the database name to A ( dummy name given here)

        i also tried that on msaccess sql prompt window , there are it works correct. but not sure why it returns an error from the application.

        Comment


        • #5
          Does it show where the syntax is? in MySQL it shows the area where it errored out.
          Have a Script or Snippet you want to share?

          WWW Standards: HTML 4.01,
          HTML 5, CSS2.1, CSS3, XHTML 1.0
          PHP Standards: PHP Standards

          Comment


          • #6
            Hi,

            i m using msaccess database , and when i tried to run the same script from access it works.

            i had tried the below scripts in code and it works
            update a set amount=112 where id=1
            even this as well update a set paiddate='11/16/2013' where id=1

            but when i tried to put the multiple fields with , then it show update error.

            i havt seen such type of error
            Last edited by kirank; 01-16-2014, 05:46 AM.

            Comment


            • #7
              Try this

              update a set amount=112, paidstatus='No', paiddate='11/16/2013', action='No', addedon=Now() where id=1
              Have a Script or Snippet you want to share?

              WWW Standards: HTML 4.01,
              HTML 5, CSS2.1, CSS3, XHTML 1.0
              PHP Standards: PHP Standards

              Comment


              • #8
                Originally posted by scoutt View Post
                Try this

                update a set amount=112, paidstatus='No', paiddate='11/16/2013', action='No', addedon=Now() where id=1
                Thanks for reply, May i know wht did you changed here?

                Comment


                • #9
                  any pointers?

                  Comment


                  • #10
                    did my example work or not?
                    Have a Script or Snippet you want to share?

                    WWW Standards: HTML 4.01,
                    HTML 5, CSS2.1, CSS3, XHTML 1.0
                    PHP Standards: PHP Standards

                    Comment


                    • #11
                      i tried you suggestion but sorry it's not working for me.

                      may i know wht changes u did in this, coz it looks same as my query.

                      thanks for your reply.

                      Comment


                      • #12
                        Sometimes when you don't have the correct spaces after , it complains. We need to the see the exact query in the code to make sure we are not missing anything.
                        Have a Script or Snippet you want to share?

                        WWW Standards: HTML 4.01,
                        HTML 5, CSS2.1, CSS3, XHTML 1.0
                        PHP Standards: PHP Standards

                        Comment


                        • #13
                          Originally posted by scoutt View Post
                          Sometimes when you don't have the correct spaces after , it complains. We need to the see the exact query in the code to make sure we are not missing anything.
                          Here you can find my inline query , i i tried removing space and all in the query but still no luck .

                          Dim cb As String = "update cheque set chequename='" & txtchqname.Text & "',chequedt='" & txtchqdt.Text & "',chequeno='" & txtchqno.Text & "' ,paiddt='" & dtchpaid.Text & "',status='" & cmbchqstatus.Text & "', amt='" & txtchqamt.Text & "', addedon= Now() where chequeno='" & RowId & "'"

                          This line works for me from another page. but i m not able to find any difference in both the query.

                          thanks for you reply.
                          Attached Files

                          Comment


                          • #14
                            any suggestion here?

                            Comment


                            • #15
                              is that table structure for the update statement? if so it is not the same. Other than that I don't have any idea, it looks good to me.
                              Have a Script or Snippet you want to share?

                              WWW Standards: HTML 4.01,
                              HTML 5, CSS2.1, CSS3, XHTML 1.0
                              PHP Standards: PHP Standards

                              Comment

                              Working...
                              X