By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 820 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

Update data using Connection

werks
100+
P: 220
I have this code

Expand|Select|Wrap|Line Numbers
  1. CoNN.BeginTrans
  2. 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 & ";"
  3. CoNN.CommitTrans
  4.  
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..
Feb 2 '08 #1
Share this Question
Share on Google+
6 Replies


lotus18
100+
P: 866
I have this code

Expand|Select|Wrap|Line Numbers
  1. CoNN.BeginTrans
  2. 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
  3. CoNN.CommitTrans
  4.  
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
Feb 2 '08 #2

werks
100+
P: 220
Tnx 4 the urgent reply. yes im using MS Access.. is there anyway to update data using Connection?
Feb 2 '08 #3

lotus18
100+
P: 866
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
Feb 2 '08 #4

werks
100+
P: 220
wow! it works!! thanx! thanx!


Your Better Than Yesterday ^^
Feb 2 '08 #5

werks
100+
P: 220
You save my valuable 30mins..hehehe tenk you reys!!
Feb 2 '08 #6

lotus18
100+
P: 866
wow! it works!! thanx! thanx!


Your Better Than Yesterday ^^
You're welcome : )
Feb 2 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.