Programming | data | Database are you satisfied with the database you designed? Are you sure you don't want to deal with it? For example, create a new database table, such as creating or modifying a field ... Of course, these are all part of the design database.
So, your normal operation is not to download the database to the local computer, and then open it to modify, and then upload it up? Ten to one,-_-!.
Now, you can contact with the information about this, after all, the function of the Code is for manual operation to save a lot of time. But is the code generation still not manual? Hehe:)
1, set up database file Cnbruce.mdb (no table design)
To build the code for the database:
<%
Option Explicit
Dim DatabaseName ' defines the database name
Databasename= "Cnbruce.mdb" database name
Dim DatabasePath ' Defines the database store path
Databasepath= "e:\cnbruce\database\" Database absolute path
Dim databasever ' defines 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 & ";D ata source=" & filepath & filename)
End If
End Function
Call Createdfile (databasepath,databasename,databasever) ' Create a database
%>
So, let's look at how to design a new database table.
2, establish 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, set up a new database table of the 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 is established.
CREATE table Aboutme (ID integer primary key,name text,birthday datetime)
Create a new table Aboutme, design a field with ID (primary key), name (memo), Birthday (time date)