ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 23rd, 2003, 07:32 AM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
Question Adding Tables to a database

Is it possible to add tables to a MSAccess Database using ADO in ASP? That means in an ASP script. Is it?

thanks, ben.

Reply With Quote
  #2  
Old July 23rd, 2003, 07:39 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Actually you'll need to use SQL to create your TABLE.

Look into CREATE TABLE....syntax

something like:

strSql = "CREATE TABLE..."

objConn.Execute strSql ....


Hope this helps!
Sincerely

Vlince

Reply With Quote
  #3  
Old July 24th, 2003, 07:27 AM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
Thanks.

But I stil have a problem, I learned the syntax of the CREATE TABLE statment but I don't know how to defiene a Autonumber Feild, The syntax is like this:

sql = "CREATE TABLE tblname(Feildname FEILDTYPE, Feildname FEILDTYPE...)"
conn.Execute sql

now if I write TEXT in the feildtype it works, but if I type AUTONUMBER in the feildtype an error is executed that says:

"
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition.

/tests/DBR/ct.asp, line 11
"

Is their a way to set a feild to AUTONUMBER?

Reply With Quote
  #4  
Old July 24th, 2003, 07:46 AM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I found this example googling on the web and look what I've found


CREATE TABLE tblContacts2 (
ID COUNTER,
LastName CHAR(40),
FirstName CHAR(40),
HomePhone CHAR(40),
WorkPhone CHAR(40),
Fax CHAR(40),
Email CHAR(40),
Address1 CHAR(40),
Address2 CHAR(40),
City CHAR(30),
State CHAR(10),
ZipCode CHAR(20),
CONSTRAINT ID_PK PRIMARY KEY(ID)
)

That is just an example

Hope this helps!
Sincerely

Vlince

Reply With Quote
  #5  
Old July 24th, 2003, 10:25 AM
Shad Shad is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 24 Shad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Code:
CREATE TABLE mytable
    (
      myfield INTEGER NOT NULL IDENTITY (1, 1) CONSTRAINT pk_myfield PRIMARY KEY
    )
Starts the unique values at 1 and increments by 1.

Reply With Quote
  #6  
Old July 24th, 2003, 03:10 PM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
Tanks guy it worked!

I wrote the ID as Counter TYPE and it is an AUTONUMBER Type by MS Access, so thanks....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Adding Tables to a database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway