PDA

View Full Version : How to insert a column values in existing db (msaccess 2000) table?


gilgalbiblewhee
04-07-2005, 01:56 AM
Here's the link for the db table:
http://k.domaindlx.com/gemetria/pageing.asp

How do I insert a field of values?

Bullschmidt
04-13-2005, 09:59 AM
The page gave some kind of not enough storage error.

www.asp101.com has a Samples area with some short database examples.

miranda
04-13-2005, 08:22 PM
Are you unable to work on the database directly in Access?

gilgalbiblewhee
04-14-2005, 05:36 PM
http://k.domaindlx.com/gemetria/pageing.asp
It works when I go there. Except there is a blank "new_gemetria" field.

The problem is I'm trying to figure out how to add a field by using ASP/ADO. Any good tutorial on this online?

gilgalbiblewhee
04-14-2005, 06:01 PM
I found this tutorial but the it is for adding records not field values. I HAVE the values of the rest of the fields. I just need to ADD a field in the database table.
http://www.w3schools.com/ado/ado_add.asp

miranda
04-14-2005, 08:46 PM
to add a column into a database table via asp use the ALTER TABLE statement. This works like so
ALTER TABLE tablename ADD COLUMN columnName datatype
where tablename is the name of your table
columnName is the new field you want to add
datatype is the access datatype. ie Text, Memo, Number, AutoNumber, DateTime, YesNo, Currency
IF this is of the TEXT datatype then in parenthesis add the size of the field

example

<%
Dim myRS, objConn, connString
connString = Server.MapPath("myAccessDB.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & connString
Set myRS = objConn.Execute("ALTER TABLE employees ADD COLUMN notes TEXT(50);")
If err.Number = 0 Then
Response.Write "Column successfully added."
Else
Response.Write "Error Encountered<br>" & err.Number & "<br>" & err.Description
End If
%>

Bullschmidt
04-15-2005, 01:57 AM
http://k.domaindlx.com/gemetria/pageing.asp
It works when I go there. Except there is a blank "new_gemetria" field.

The problem is I'm trying to figure out how to add a field by using ASP/ADO. Any good tutorial on this online?


If the field already exists in the table but all the values are still blank but you want them all to be "School" or whatever then perhaps all you need is to run a SQL statement that is akin to an Access update query.

Or of course just manually enter the data in the database (or use whatever admin tool is available to do that).

And if you don't have an admin tool here is something to consider.

For a "quick and dirty" generic ASP open source solution to putting databases on the Web (often works well for the admin area of a Web site which doesn't need to look too unique) that just requires setting up a configuration page for each table or query and uploading the database to the Web as long as there is an autonumber field in each table (and you'll probably also separately want to create login capabilities), perhaps try something like this:
GenericDB by Eli Robillard
http://www.genericdb.com and then click on the Tips link to see an example