Update data using Connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • werks
    New Member
    • Dec 2007
    • 218

    Update data using Connection

    I have this code

    Code:
    CoNN.BeginTrans
    CoNN.Execute "UPDATE tblsubject SET [Subject1]='" & txtSubject1.Text & "', [Subject2]='" & txtSubject2.Text & "', [Subject3]='" & txtSubject3.Text & "', [Subject4]='" & txtSubject4.Text & "', [Subject5]='" & txtSubject5.Text & "', [Subject6]='" & txtSubject6.Text & "', [Subject7]='" & txtSubject7.Text & "', [Subject8]='" & txtSubject8.Text & "' WHERE [SubjectID]=" & v_ID & ";"
    CoNN.CommitTrans
    There is no problem in adding, my problem is that it doesn't update using the same code.. Do i have to use the Adodb.Recordset in updating the data?

    tnx in advance..
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    Originally posted by werks
    I have this code

    [CODE=VB]
    CoNN.BeginTrans
    CoNN.Execute "UPDATE tblsubject SET [Subject1]='" & txtSubject1.Tex t & "', [Subject2]='" & txtSubject2.Tex t & "', [Subject3]='" & txtSubject3.Tex t & "', [Subject4]='" & txtSubject4.Tex t & "', [Subject5]='" & txtSubject5.Tex t & "', [Subject6]='" & txtSubject6.Tex t & "', [Subject7]='" & txtSubject7.Tex t & "', [Subject8]='" & txtSubject8.Tex t & "' WHERE [SubjectID]=" & v_ID
    CoNN.CommitTran s
    [/CODE]

    There is no problem in adding, my problem is that it doesn't update using the same code.. Do i have to use the Adodb.Recordset in updating the data?

    tnx in advance..
    Omit & ";" at the end of your statement. I'm assuming that the Subject ID is an integer type. BTW, are you using as access as your backend?


    Rey Sean

    Comment

    • werks
      New Member
      • Dec 2007
      • 218

      #3
      Tnx 4 the urgent reply. yes im using MS Access.. is there anyway to update data using Connection?

      Comment

      • lotus18
        Contributor
        • Nov 2007
        • 865

        #4
        Originally posted by werks
        Tnx 4 the urgent reply. yes im using MS Access.. is there anyway to update data using Connection?
        Did you try the codes on my post #2? Yes, there is an alternative option, you can open a recordset for that.

        Rey Sean

        Comment

        • werks
          New Member
          • Dec 2007
          • 218

          #5
          wow! it works!! thanx! thanx!


          Your Better Than Yesterday ^^

          Comment

          • werks
            New Member
            • Dec 2007
            • 218

            #6
            You save my valuable 30mins..hehehe tenk you reys!!

            Comment

            • lotus18
              Contributor
              • Nov 2007
              • 865

              #7
              Originally posted by werks
              wow! it works!! thanx! thanx!


              Your Better Than Yesterday ^^
              You're welcome : )

              Comment

              Working...