Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Recordset.Append

Status
Not open for further replies.

link9

Programmer
Nov 28, 2000
3,387
0
0
US
Hello all --

A co-worker of mine and I are trying to do something, and we're getting run-time errors, and I would like for someone to be able to definitely confirm or deny our ability to do it.

We have an ADO Recordset that has records in it... so many columns... so many rows, etc...

Then, we would like to be able to append a column on to the end of it...

Is this possible?

We're receiving a runtime error #3219 "Operation not allowed in this context"

Can anyone help out with this?

Thanks! :)
paul
penny1.gif
penny1.gif
 
Hi Paul,
First tell more about your problem clearly like, which database (Software) you are using and what actually you want to do. Do you want to add new record at the end?

If so then try something like this:
adodc1.Recordset.Addnew
Adodc1.Recordset.Update

Please let me know if it solves your problem.

regards..
Rohit.
 
no... not a new record... a new column (or field) to the recordset that already has data in it. It's a custom recordset.

nothing to do with a database.

Actually, we decided it wasn't possible, and have worked around it.
penny1.gif
penny1.gif
 
We have that -- but haven't used it for anything other than some cursory training so far (conference next week ;-)). So would it be the dataset we would use to do this in adox?

And it supports this type of functionality?

thx-
paul
penny1.gif
penny1.gif
 

Sub CreateTable()

Dim tbl As New Table
Dim cat As New ADOX.Catalog

'Öffnet den Katalog.
' Öffnet den Katalog.
cat.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Programme\Microsoft Office\" & _
"Office\Beispiele\Nordwind.mdb;"

tbl.Name = "MyTable"
tbl.Columns.Append "Column1", adInteger
tbl.Columns.Append "Column2", adInteger
tbl.Columns.Append "Column3", adVarWChar, 50
cat.Tables.Append tbl

End Sub

OR

Dim cnn As New ADODB.Connection
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim col As New ADOX.Column

cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= c:\Programme\" & _
"Microsoft Office\Office\Beispiele\Nordwind.mdb;"
Set cat.ActiveConnection = cnn
tbl.Name = "MyTable"
tbl.Columns.Append "Column1", adInteger
Set col.ParentCatalog = cat
col.Name = "Column2"
col.Type = adVarWChar
col.Properties("Jet OLEDB:Allow Zero Length") = True
tbl.Columns.Append col
cat.Tables.Append tbl

 
I'm going to play with CCLINT's code - I haven't used ADOX before.
I have dealt with this type of scnario by creating an ADO recordset on the fly and copied the data from the adoDataControl Recordset into it (although I shy away from ADO data controls - I find them restrictive), careful not to break referrential integrity in the code (generic data classes will ensure that this doesn't happen though).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top