|
-
Aug 6th, 2001, 11:01 PM
#1
Thread Starter
Hyperactive Member
STUMPED with ADO Fields Collection
HELP...
I am stumped at how to append a new field to a recordset and then after that sending the new recordset with the new added field back to Access Using ADO2.0 and JET
Could anybody give me any pointers ? I am stumped at especially which part I have to close the recordset and set the activeconnection to Nothing
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
-
Aug 6th, 2001, 11:02 PM
#2
-= B u g S l a y e r =-
You want to add a new field to a table?
-
Aug 6th, 2001, 11:07 PM
#3
Thread Starter
Hyperactive Member
Yes Peet,
I want to add a new field to an Access Table BUT not using native SQL alter Table statements. I want to do it using the recordset object and fields collection of ADO...For my MCSD case study.
Thanks
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
-
Aug 6th, 2001, 11:09 PM
#4
-= B u g S l a y e r =-
oh.. I think u have to use ADOX, in order to do that.
Add a reference to the Microsoft ADO Extensions for DDL and Security (ADOX).
I'll digup a sample for u....
-
Aug 6th, 2001, 11:11 PM
#5
-= B u g S l a y e r =-
This sample show u how to create a new db and adding a table to it.
VB Code:
Option Explicit
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Private Sub Command1_Click()
Set cat = New ADOX.Catalog
Set tbl = New ADOX.Table
' create the table
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\newDB.mdb"
With tbl
.Name = "TestTable"
' Create fields and append them to the
' Columns collection of the new Table object.
With .Columns
.Append "ID COLUMN"
.Append "SetName", adVarWChar, 255
.Append "SetVal", adVarWChar, 255
.Append "Description", adVarWChar, 255
End With
End With
' Add the new Table to the Tables collection of the database.
cat.Tables.Append tbl
Set cat = Nothing
Set tbl = Nothing
End Sub
hope this can get u started
-
Aug 6th, 2001, 11:22 PM
#6
Thread Starter
Hyperactive Member
Hi Peet
I really appreciate the help you have given me peet
The thing is I need to append a new field using ADODB...Is that possible at all ?
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
-
Aug 6th, 2001, 11:54 PM
#7
-= B u g S l a y e r =-
don't think so, but I'm not 100 % sure though... but I'v never seen it done.
anyone else have any input ?
-
Aug 7th, 2001, 04:50 AM
#8
Lively Member
This can't be done with ADO. You have to use ADOX or DAO
Cenobite
-
Aug 7th, 2001, 04:37 PM
#9
Thread Starter
Hyperactive Member
THanks Cenobite,
I guess I have to stick with the commandText property of the ADO Command Object to append fields to a database using native SQL Alter Keyword statements for now.
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
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
|