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

2019-01-14 08:01:18于丽

    if rs.eof and action = "new" then
        sql = "Select * From [" & names & "]"
        rs.Open sql, conn, 1, 3
    end if

    if action = "save" or action = "new" then
        If action = "new" Then rs.AddNew
        For Each tab In rs.Fields
            If Keys <> tab.Name Then
                rs(tab.Name) = Request.Form(tab.Name & "_Column")
                if err <> 0 then
                    echo tab.name & err.description
                    echo "<input type='button' name='ok' value=' 返 回 ' onClick='javascript:history.go(-1)'>"
                    response.end
                end if
            End If
        Next
        rs.update
    end if

    echo "字段数据编辑<br>"
    echo "<table width=600 border=0 cellpadding=5 cellspacing=1 bgcolor=#CCCCCC><tr><td>"
    echo "<form action='?key=edit&table_name=" & names & "&primarykey=" & keys & "&primarykeyvalue=" & iif(action<>"add",rs(keys),"") & "' method='post' name='editor'>"
    echo "<br>"
    echo "<input type=hidden name=action value=save>"
    echo iif(action="add","","<input type=submit value=保存 onclick=this.form.action.value='save';> ")
    echo "<input type=button value=添加 onclick=if(confirm('确实要添加当前为新记录吗?')){this.form.action.value='new';this.form.submit();};> "
    echo "<input type=button value=上一条 onclick=""this.form.action.value='pre';this.form.submit();""> "
    echo "<input type=button value=下一条 onclick=""this.form.action.value='next';this.form.submit();"">  "
    echo "<a href='?key=view&table_name=" & names & "'>表结构</a>  "
    echo "<a href='?key=sql&sql=select * from " & names & "&table_name="& names & "&primarykey="&keys&"'>表浏览</a>  "
    echo "<a href='?'>主界面</a><br>"
    if not rs.eof or action = "add" then
        For Each tab In rs.Fields
            echo ""
            echo "<BR><font color=red>" & tab.Name & "</font> <font color=#999999>( " & typ(tab.Type) & " )</font><br>"
            if tab.Type = 201 Or tab.Type = 203 then
                echo "<textarea style='width:600;' name=""" & tab.Name & "_Column"" rows=6"
                echo IIf(tab.Name = keys, " disabled title='主键约束,将无法被修改.'>", ">")
                if action <> "add" then echo trim(tab.value)
                echo "</textarea>"
            else
                echo "<input type='text' style='width:600;' name='" & tab.Name & "_Column'"
                echo IIf(tab.Name = keys, " disabled title='主键约束,将无法被修改.'", " ") & " value='"
                if action <> "add" then echo trim(tab.value)
                echo "'>"
            end if
            echo "<br>"
        Next