|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Adding a Field to a populated ado recordset :: RESOLVED
Hi,
I'm trying to add a field to an already populated ado recordset. The problem is that in order to add the field I need to close the recordset, which causes the loss of all the records in it. Help would be appreciated Last edited by shafan : May 15th, 2003 at 01:45 AM. |
|
#2
|
|||
|
|||
|
How is the rs being stored ? i.e. what db format
Can you open up the db and add the field manually, rather than through ADO commands. Also - have a look at Devguru - ADO
__________________
How can I soar like an eagle when I'm flying with turkey's? |
|
#3
|
||||
|
||||
|
I've resolved it by creating a dummy field in the database
|
|
#4
|
|||
|
|||
|
well done...
![]() |
|
#5
|
|||
|
|||
|
You cant do Fields.Add, but as long as there is a field in the db of the right type, you can select it in your query and use it as an "added field" - as long as you detach the recordset. Detach the recordset so you can update the temp field without changing the db. This assumes you ar not using the recordset to update the database....
Lets say my program uses a recordset and I need to hold temp data for each record. vb psuedo code: sSQL = "SELECT SomeIntegerField as Temp, * FROM SomeTable" rs.Open sSQL, Ado, adOpenDynamic, adLockBatchOptimistic Set rs.ActiveConnection = Nothing rs.MoveFirst Do While Not rs.EOF rs!Temp = Some calculation or whatever rs.MoveNext Loop do whatever I want with rs!temp throughout the program I don't know if adOpenDynamic is the only type of recordset this works with. I do know that adLockReadOnly will not work. Also Temp and SomeIntegerField (because * was used, SomeIntegerField will be available in the above example) are independent - Temp is not an alias - so they can have separate values in them. You can |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Adding a Field to a populated ado recordset |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|