WEB开发网
开发学院WEB开发ASP 用sql语句动态的创建access表 阅读

用sql语句动态的创建access表

 2009-06-04 12:06:42 来源:WEB开发网   
核心提示:用sql语句动态的创建access表的代如下!<% nowtime=now() tablename=cstr(year(nowtime))+\"_\"+cstr(second(nowtime)) response.writetablename db_path=\"test.mdb\&

用sql语句动态的创建access表的代如下!

<%
 nowtime = now()
tablename = cstr(year(nowtime))+\"_\"+cstr(second(nowtime))
response.write tablename  
db_path = \"test.mdb\"
Set conn= Server.CreateObject(\"ADODB.Connection\")
connstr = \"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"&Server.MapPath(db_path)
conn.Open connstr
Set rs = Server.CreateObject (\"ADODB.Recordset\")
sql = \"create table \"& tablename &\" (id integer primary key,name text,Birthday datetime)\"
rs.Open sql,conn,2,3
%>

Tags:sql 语句 动态

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接