|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
create object & DAO
hi,
how to create dao.tabledef object in asp: I need to convert the following code into asp: Dim tdf As DAO.TableDef Dim db As DAO.Database Dim fld As DAO.Field Set db = OpenDatabase("C:\Mydb.mdb") Set tdf = db.TableDefs("Table1") Set fld = tdf.CreateField("Field2", dbText, 10) tdf.Fields.Append fld Please help. Thanks. js wrote:
Show quote > hi, You need to use ADOX: http://www.mikebrind.com/article.asp?id=4> how to create dao.tabledef object in asp: > > I need to convert the following code into asp: > Dim tdf As DAO.TableDef > Dim db As DAO.Database > Dim fld As DAO.Field > > Set db = OpenDatabase("C:\Mydb.mdb") > Set tdf = db.TableDefs("Table1") > Set fld = tdf.CreateField("Field2", dbText, 10) > tdf.Fields.Append fld > > Please help. Thanks. -- Mike Brind js wrote:
Show quote > hi, DAO is a single-threaded COM object whose use is vehemently discouraged in> how to create dao.tabledef object in asp: > > I need to convert the following code into asp: > Dim tdf As DAO.TableDef > Dim db As DAO.Database > Dim fld As DAO.Field > > Set db = OpenDatabase("C:\Mydb.mdb") > Set tdf = db.TableDefs("Table1") > Set fld = tdf.CreateField("Field2", dbText, 10) > tdf.Fields.Append fld > > Please help. Thanks. ASP. There are several other ways to create tables in Access databases including ADOX and SQL DDL. Mike's already provided a link to an ADOX article, so let me describe the DDL variation: Simply create a sql statement containing the appropriate DDL (Data Definition Language) and use a connection object to execute it. For your example, I would use: sql="CREATE TABLE Table1 (Field2 TEXT(10))" The appropriate datatype keywords can be found in Access online help (look at the table of contents and expand the Microsoft Jet SQL Reference node, drilling down until you get to the "SQL Data Types" topic -- Microsoft MVP -- ASP/ASP.NET Please reply to the newsgroup. The email account listed in my From header is my spam trap, so I don't check it very often. You will get a quicker response by posting to the newsgroup. Thansk for the help.
Show quote "js" <js@some***@hotmail.com> wrote in message news:%239%23Co$mQGHA.6008@TK2MSFTNGP10.phx.gbl... > hi, > how to create dao.tabledef object in asp: > > I need to convert the following code into asp: > Dim tdf As DAO.TableDef > Dim db As DAO.Database > Dim fld As DAO.Field > > Set db = OpenDatabase("C:\Mydb.mdb") > Set tdf = db.TableDefs("Table1") > Set fld = tdf.CreateField("Field2", dbText, 10) > tdf.Fields.Append fld > > Please help. Thanks. > > |
|||||||||||||||||||||||