|
-
April 2nd, 2001, 11:52 PM
#1
Update several records at the same time
I need to update several records at the same time.
I used
for i = 0 to 3
rs("name") = UCase(Trim(txtName(i).Text))
rs("age") = UCase(Trim(txtAge(i).Text))
rs("preference") = txtPref
rs.Update
next i
It failed to work :
"Method of update of object recordset failed"
Can anyone help me?
-
April 3rd, 2001, 01:03 AM
#2
Re: Update several records at the same time
Hi
If u use the Update Method, U will have to use
either Addnew or Edit method.
The code should look like
for i = 0 to 3
rs.Addnew ( or ) rs.Edit
rs("name") = UCase(Trim(txtName(i).Text))
rs("age") = UCase(Trim(txtAge(i).Text))
rs("preference") = txtPref
rs.Update
next i
All the best
Bye Bye take Care
Vijooo
-
April 3rd, 2001, 01:21 AM
#3
Re: Update several records at the same time
...and use edit to modify existing records. Use addnew to create a new record. Do not forget to rate Vijoo if he helped you.
Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
April 3rd, 2001, 06:06 AM
#4
Re: Update several records at the same time
Vijooo, I have tried what you have suggested, but there is no Edit method !!!
I can only find EditMode method instead.
When I used rs.EditMode, it prompted an error "Invalid use of property".
What's wrong ???
Please help me
-
April 3rd, 2001, 07:08 AM
#5
Re: Update several records at the same time
Edit exists only for DAO, for ADO you don't have to use rs.Edit
Iouri Boutchkine
[email protected]
-
April 3rd, 2001, 07:17 AM
#6
Re: Update several records at the same time
HI
If u r using ADO, then u wont be having the
Edit Method. If u r working with DAO then it
can be used.
Anyway , Idf u want to edit a Particular record
Then use the Execute Method with SQL Query.
Sql query will look like this.
For Edit
Update [Table Name] Set [Field Name] = Values
Where Condition.
For Addition
Insert Into [Table Name] ( values )
Make the queries to execute in Execute Method.
This is the best way to work with ADO.
Mail me back about the status.
All the best
Take Care Bye Bye
Vijooo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|