ASP动态创数据库及表(Access)

<%
db="data.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source ="&Server.MapPath(db)
'创建数据库
Set Ca = Server.CreateObject("ADOX.Catalog")
call Ca.Create(""&ConnStr&"")
Set Ca = Nothing

'创建表
conn.open ConnStr
strSQL ="CREATE TABLE links ( "
strSQL =strSQL +"id autoincrement PRIMARY KEY, "
strSQL =strSQL +"logo text(50) Null, "
strSQL =strSQL +"zhu text NULL, "
strSQL =strSQL +"itime datetime NULL default now(), "
strSQL =strSQL +"display int NULL default 0, "
strSQL =strSQL +"ftbbs_pass text(1) Null default N"
strSQL =strSQL +") "
Conn.Execute(strSQL)
 %>

你可能感兴趣的:(Access)