0

I have an website written in ASP classic with VB. I need to add a column to the table, but I cannot take down the website to be able to edit the table in access. How do I do this in code?

I am very new to ASP and access, I have a lot of experience in PHP and MYSQL but I have been able to find the syntax.

Thanks for all assistance.

2 Answers 2

2

OpenDB("database/cpio.mdb") SQL = "ALTER TABLE Members ADD business_url text"

dbRS1.Open SQL, dbConn, adOpenDynamic, adLockOptimistic

Sign up to request clarification or add additional context in comments.

Comments

0

Should be relatively easy if you are already connecting to the database and executing queries. Try:

ALTER TABLE <table> ADD COLUMN <column> <type> NULL/NOT NULL

5 Comments

OpenDB("../database/database_name.mdb") ALTER TABLE Members ADD COLUMN Agency Integer NOT NULL Is that all i need?
It looks right to me. Do you have a test environment you can try it out on first? Or, grab a copy of the database and try it with VBScript first.
I don't have a test environment, and it does not work.. Microsoft VBScript runtime error '800a000d' Type mismatch: 'OpenDB' /edit_database.asp, line 3
Can you post a full example on pastebin?
got it! OpenDB("database/cpio.mdb") SQL = "ALTER TABLE Members ADD business_url text" dbRS1.Open SQL, dbConn, adOpenDynamic, adLockOptimistic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.