473,419 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

create object & DAO

js
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.
Mar 8 '06 #1
3 3068

js wrote:
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.

You need to use ADOX: http://www.mikebrind.com/article.asp?id=4

--
Mike Brind

Mar 8 '06 #2
js wrote:
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.


DAO is a single-threaded COM object whose use is vehemently discouraged in
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.
Mar 8 '06 #3
js
Thansk for the help.

"js" <js@so*****@hotmail.com> wrote in message
news:%2******************@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.

Mar 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: El Diablo | last post by:
Hi there, I'm trying dynamically generate extra rows in a table. So far this achieves this task within the tHead segment: theTable.tHead.appendChild(document.createElement('TR')) ....but...
4
by: ITMA | last post by:
Any Google search will show that somewhere out there is a kind spirited Michel Walsh has been most generous in his time over the years in giving, in reply to several postings on the matter, a...
2
by: Matthew Hood | last post by:
I'm at a loss on how to create global functions for my website. Essentially, I have several different functions I use throughout my site and I want to be able to put these in 1 file and call them...
6
by: Peter Nurse | last post by:
For reasons that are not relevant (though I explain them below *), I want, for all my users whatever privelige level, an SP which creates and inserts into a temporary table and then another SP...
0
by: dolittle | last post by:
Hi, I'm embedding a last.fm flash widget. I want to be able to remove it from the page using javascript. I've tried to delete the html element that contains the code but it keeps playing in...
0
by: TrevRex | last post by:
Hello, I work for a non-profit in San Diego as a GIS Specialist. I have had to teach myself about some scripting to create some dynamic maps, but I am still very limited in my skills, so I have...
3
by: Giovanni Gherdovich | last post by:
Hello, in the following code I have a pointer (to function), say p, of type double (*)(double, double, void*) and I try to fix the second argument of the function *p to a given value (using...
2
by: bips2008 | last post by:
The code seems to work fine in other browser but in IE it throws this error. This is very urgent for me and any help would be greatly appreciated For your convienence i have posted the code for the...
1
by: CodeJoker | last post by:
I am a beginner at programming no classes it's sel study with e-books but hey everyone gets stuck. . . I have a snippet of code that I need someone to revise and if possible advice on sorting out my...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.