当前位置: 网学 > 编程文档 > ASP > 正文

在线数据库管理工具(db007) v1.5

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 13/06/17
t;
</form>
<%
end sub

''==================================================================构建创建表的SQL语句
sub create_table()
dim sql,i,primarykey
on error resume next
sql = "CREATE TABLE ["&request("table_name")&"] ("
for i = 1 to request("i")
sql = sql & "[" & request("field_name")(i) & "] " & request("field_type")(i)
if request("field_size")(i) <> "" then
sql = sql & "(" & request("field_size")(i) & ")"
end if
if request("null")(i) = "NOT_NULL" then
sql = sql & " not null"
end if
if request("autoincrement")(i) = "自动编号" then
sql = sql & " identity"
end if
if request("primarykey")(i) = "primarykey" then
primarykey = request("field_name")(i)
end if
''if primarykey <> "" then
sql = sql & ","
''end if
next
if primarykey<>"" then
sql=sql&" primary key (["&primarykey&"]) "
end if
sql = sql & ")"
sql = replace(sql,"()","") ''构建空表
response.redirect "?key=sql&sql=" & sql
end sub


''==================================================================修改表名或字段名 2006-09-08
sub reobj()
on error resume next
Dim mydb,mytable,tablename
tablename = request("tablename")
Set mydb = Server.CreateObject("ADOX.Catalog")
mydb.ActiveConnection = conn

if request("obj") = "field" then ''修改字段名
dim fieldsname,newfieldsname
fieldsname = request("fieldsname")
newfieldsname = request("newfieldsname")
Set mytable = Server.CreateObject("ADOX.Table")
Set mytable = mydb.Tables(tablename)
mytable.Columns(fieldsname).Name = newfieldsname
end if

if request("obj") = "table" then ''修改表名
dim newtablename
newtablename = request("newtablename")
mydb.Tables(tablename).Name = newtablename
end if

if err <> 0 then
echo err.description
echo "<input type=''button'' name=''ok'' value='' 返 回 '' onClick=''javascript:history.go(-1)''>"
exit sub
end if

if request("obj") = "field" then
response.Redirect "?key=view&table_name=" & tablename
else
response.Redirect "?key=view&table_name=" & newtablename
end if

end sub

''==================================================================查看表结构函数
sub view(table_name)
''table_name = 表名称
dim rs,sql,table,primary,primarykey,i,editstr,typs
on error resume next
table = table_name
Set primary = Conn.OpenSchema(adSchemaPrimaryKeys,Array(empty, empty, table))
if primary("COLUMN_NAME") <> "" then
primarykey = primary("COLUMN_NAME")
end if
primary.Close
Set primary = Nothing

%>

<script language="javascript">
function table_delete()
{
if (confirm("确认删除该记录吗? 该操作将不可撤销!!!"))
return
  • 上一篇资讯: ASP中过滤UBB和Html标签
  • 下一篇资讯: Response.Flush的使用心得
  • 网学推荐

    免费论文

    原创论文

    浏览:
    设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
    版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
    Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
    湘ICP备09003080号