-
Working with Recordsets
Is there a way of dynamically creating full featured recordsets. For example, if I use the ADODC control, I can use Recordcount, AddItem, Update, etc. However, if I create a dynamic recordset on the fly such as
public sqlTest as string
public rstTest as New ADODB Recordset
sqlTest = "Select * from test"
rstTest.Open sqlTest, strFile, adOpenDynamic
rstTest.AddNew
This gives me very limited capabilities. The AddNew isn't available
Is it that I have an "old" version of the control or is there something else I need.
Thanking you in advance for your help
-
AddNew is definitely available.
When you Open a recordset the default lock type is read only.
Provided everything else is correct, changing the open statement to rstTest.Open sqlTest, strFile, adOpenDynamic, adLockOptimistic will allow you to add new records.
-
use the Command object to do this.
u can then use SQL Insert, Update, create table and delete Queries with this object. if u cannot work it ur self, then post a reply. i will make a small program for u.
zia.
-
Thanks:
Just one more question.....
With adding the AdLockOptimistic, I can add records just fine now. However, I still can't "change" records that are already in the record set. When I do something like:
me.rstTest!name = me.txtTest.text
me.rsttest.updade
I can see the changes when I cycle through the record set, but it doesn't get written to the actual table for the next time I open a recordset.