Add A New Column to an Access database
posted at 18:00:13 By Flipping Heck! | Posted In Technical |
|
I thought it was about time I put something technical on this site as that's what I started it for!
Because I don't have Access 2000 on a computer I have been unable to manipulate my databases using SQL as Access doesn't support the "Alter Table" command under Jet Connections. It was quite difficult to find the solution so now I have I thought I'd share it with all of you. Aren't I nice?!
<%@ Language=VBScript %>
<!--#include file="includes/adovbs.inc"-->
<%
'Open the database
dim objConn, strCon
Set objConn = Server.CreateObject("ADODB.Connection")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\inetpub\path\to\db\dbname.mdb"
objConn.connectionstring = strCon
objConn.Open
objConn.Execute "ALTER TABLE TBLComment ADD COLUMN CommentHP VARCHAR(255) NULL;"
Response.Write ("Table Update Done")
%>Have a look at
W3Schools to see more Table functions which should work using the above code, the site gives you more information about SQL.
Hope you find that handy!
If you liked this, you may also like
Like this article? Add it to: