[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

Assignment of a value to a Record Set Object with ADO?

Why do we get a Runtime Error (-2147467259(80004005))? The Statement is done but the MoveNext-Methode cuts off.

With rs
.ActiveConnection = frmMain.m_dbConn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Source = sSQLAbr
.Open
End With

While Not rs.EOF
       
rs!VersandartenText = "hallo"
rsmerk.MoveNext
       
Wend



0
blackjack020900
Asked:
blackjack020900
1 Solution
 
deightonCommented:
'why not

While Not rs.EOF
                           
rs!VersandartenText = "hallo"
rs.MoveNext
                           
Wend




0
 
p_biggelaarCommented:
I'd also advice to use rs.Update so you make sure the datachanges will be committed, like

rs!VersandartenText = "hallo"
rs.Update
rs.MoveNext

cheerio
0
 
blackjack020900Author Commented:
I don't want to make an update, because the field doesn't exist in the database it's only located in a Record Set.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
mark2150Commented:
Well then how do you expect to assign a value to a field that doesn't exist? If you've created a transient field for a result then it's READ ONLY and you can't assign back to it.

M
0
 
blackjack020900Author Commented:
The field was selected with the following statement:
sSQLAbr =
" select  versandart," &_
" VersandartenText= 'xxxxxxxxxxxxx'" &_
" from auftrag"
....

This means, the field does not exist in the DB but is only generated in the SELECT statement
0
 
p_biggelaarCommented:
Then it should crash in the assign statement rs!vers...="Hallo", and not in the movenext!! You don't have a field called VersandartenText because:
- it doesn't exist in the db
- you didn't add it as an alias in the select statement
0
 
blackjack020900Author Commented:
Thanks!
It just took a while till I figured it out!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now