Are you satisfied with your own database design? Are you sure you don't want to deal with it? For example, creating a new database table, such as creating or modifying a field ...... Of course, these are the columns of the design database.
In this case, do you need to download the database to the local machine, open it, modify it, and upload it again? This is the case in -_-!
Now you can access the information about this. After all, the code function saves a lot of time for manual operations. But isn't code generated manually? Haha :)
1. Create the database file cnbruce. mdb (no table is designed)
Database creation code:
<% Option Explicit Dim databasename 'defines the Database Name Databasename = "cnbruce. mdb" 'Database Name Dim databasepath 'defines the database storage path Databasepath = "e: \ cnbruce \ database \" 'absolute database path Dim databasever 'defines the database version 2000 or 97 Databasever = "2000"Function Createdfile (FilePath, FileName, Ver) Dim cnbruce, dbver Select case ver Case "97" Dbver = "3.51" Case "2000" Dbver = "4.0" End select If dbver <> "" then Set cnbruce = Server. CreateObject ("ADOX. Catalog ") Call cnbruce. Create ("Provider = Microsoft. Jet. OLEDB." & dbver & "; Data Source =" & filepath & filename) End if End Function Call Createdfile (databasepath, databasename, databasever) 'To create a database %> |
Then, let's see howDesign and create a new database table
2. Create the database connection file conn. asp
<% Db_path = "cnbruce. mdb" Set conn = Server. CreateObject ("ADODB. Connection ") Connstr = "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & Server. MapPath (db_path) Conn. Open connstr %> |
3. Create a new database table program page, addtable. asp
| <! -- # Include file = "conn. asp" --> <% Set rs = Server. CreateObject ("ADODB. Recordset ") SQL = "create table aboutme (id integer primary key, name text, Birthday datetime )" Rs. Open SQL, conn, 2, 3 %> The database table file has been created. |
Create table aboutme (id integer primary key, name text, Birthday datetime)
Create a new table named aboutme, and design the fields including id (primary keyword), name (remarks), and Birthday (time and date)