| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 762 人关注过本帖
标题:求助!怎么在添加页面表单中调用SQL数据库中其他表中的用户登陆名字
只看楼主 加入收藏
mafuyu
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-9-23
收藏
 问题点数:0 回复次数:1 
求助!怎么在添加页面表单中调用SQL数据库中其他表中的用户登陆名字
求助!怎么在添加页面表单中调用SQL数据库中其他表中的用户登陆名字?我想在一个提交页面中加入已经存在的用户名称,将该名称写入数据库其他新的表中。现在的代码如下:
<%response.expires=0%>
<!--#include file="../../../inc/sqlstr.asp"-->
<!--#include file="../../../inc/opendb.asp"-->
<!--#include file="../../../inc/checked.asp"-->
<%
function strlength(inputstr)
    dim length,i
    length=0
    for i=1 to len(inputstr)
        if asc(mid(inputstr,i,1))<0 then
            length=length+2
        else
            length=length+1
        end if
    next
    strlength=length
end function
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
    response.write("<script language=""javascript"">")
    response.write("window.top.location.href='default.asp';")
    response.write("</script>")
    response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../../../css/css.css">
<script language="vbscript">
sub checkkey()
    if window.event.keyCode  >57 or window.event.keyCode <48 then
        if window.event.keyCode<>45 and window.event.keyCode<>40 and window.event.keyCode<>41 then
            window.event.keyCode=0
        end if
    end if   
end sub
</script>
<!--#include file="../../../inc/Company.asp"-->
<title><%=Companycn%></title>
<style type="text/css">
/* CSS Document */

body {
    font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #4f6b72;
    background: #ffffff;
}

a {
    color: #c75f3e;
}

#mytable {
    width: 99%;
    padding: 0;
    margin: 0;
}

caption {
    padding: 0 0 5px 0;
    width: 700px;      
    font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    text-align: right;
}

th {
    font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #4f6b72;
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    border-top: 1px solid #C1DAD7;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: left;
    padding: 6px 6px 6px 12px;
    background: #CAE8EA url(images/bg_header.jpg) no-repeat;
}

th.nobg {
    border-top: 0;
    border-left: 0;
    border-right: 1px solid #C1DAD7;
    background: none;
}

td {
    border-right: 1px solid #C1DAD7;
    border-bottom: 1px solid #C1DAD7;
    background: #fff;
    font-size:11px;
    padding: 6px 6px 6px 12px;
    color: #4f6b72;
}


td.alt {
    background: #F5FAFA;
    color: #797268;
}

th.spec {
    border-left: 1px solid #C1DAD7;
    border-top: 0;
    background: #fff url(images/bullet1.gif) no-repeat;
    font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
}

th.specalt {
    border-left: 1px solid #C1DAD7;
    border-top: 0;
    background: #f5fafa url(images/bullet2.gif) no-repeat;
    font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
    color: #797268;
}
/*---------for IE 5.x bug*/
html>body td{ font-size:11px;}
.STYLE2 {color: #FF0000}
.STYLE3 {color: #333333}
</style>
</head>
<body bgcolor="#ffffff" topmargin="5" leftmargin="5">
<center>
</center>
<%

if request("submit")="输入" then
    errorinfo=""
    unit=request("unit")
    if strlength(unit)>8 then
        errorinfo=errorinfo&"计量单位过长,不能超过4个汉字!<br>"
    end if
    caozuoyuan=request("caozuoyuan")
    if strlength(caozuoyuan)>8 then
        errorinfo=errorinfo&"操作员姓名过长,不能超过4个汉字!<br>"
    end if
    beizhu=request("beizhu")
    if strlength(beizhu)>50 then
        errorinfo=errorinfo&"备注内容过长,不能超过25个汉字!<br>"
    end if
    if errorinfo="" then
        set conn=opendb("oabusy","conn","accessdsn")
        sql = "Insert Into unit (username,unit,caozuoyuan,beizhu) Values( "
        sql = sql & SqlStr(username) & ","
        sql = sql & SqlStr(unit) & ", "
        sql = sql & SqlStr(caozuoyuan) & ", "
        sql = sql & SqlStr(beizhu) & ")"
        conn.Execute sql
        conn.close
        set conn=nothing
%>
<br><br>
<center>
  <font color=red size=3><img src="../../../img/man.jpg" width="140" height="141"></font>
  <p><img src="../../../img/ico_collect.gif" width="19" height="15" align="absmiddle"><span class="STYLE2"> 恭喜您!<b>计量单位</b>录入成功!</span></p>
  <p><img src="../../../img/help.JPG" width="32" height="32" align="absmiddle"> 返回&quot;<a href="unit_list.asp">计量单位设置</a>&quot;</p>
  <p class="STYLE2">提示:在操作过程中,如遇到任何问题,请与办公室联系!厂内电话:8008</p>
</center>
<br><br>
<%
    else
%>
<div align="center">
  <center>
    <font color=red size=3><img src="../../../img/man.jpg" width="140" height="141"></font>
    <p><img src="../../../img/ico_error.gif" width="14" height="14" align="absmiddle"><span class="STYLE2"> 出错啦!<b>计量单位</b>录入失败!</span></p>
    <p><img src="../../../img/help.JPG" width="32" height="32" align="absmiddle"> 返回&quot;<a href="unit_list.asp">计量单位设置</a>&quot;</p>
    <p class="STYLE2">提示:在操作过程中,如遇到任何问题,请与办公室联系!厂内电话:8008</p>
  </center>
  <br>
  <br>
  <font color="#ee0000" size="+1"><%=errorinfo%></font>
  <center>
    <input name="button" type="button" onClick="javascript:history.go( -1 );return true;" value="返回">
  </center>

</div>
<%
    end if
else
%>
<script Language="JavaScript">

function form_check()
{
    var l1=document.form1.unit.value.length;
    if(l1==0)
    {
        window.alert("计量单位必须填");
        document.form1.name.focus();
        return (false);
    }

    var l2=document.form1.caozuoyuan.value.length;
    if(l2==0)
    {
        window.alert("操作员姓名必须填");
        document.();
        return (false);
    }
 
    var l3=document.form1.beizhu.value.length;
    if(l3==0)
    {
        window.alert("备注内容必须填");
        document.form1.project.focus();
        return (false);
    }
}
</script>
 
<center>
  <form method="post" action="unit_list.asp" name="form1" onSubmit="javascript:return form_check();">
    <table id="mytable" cellspacing="0" summary="The technical specifications of the Apple PowerMac G5 series">
    <caption>
    </caption>
    <tr>
      <th colspan="4" scope="col" abbr="Configurations"><div align="center">计量单位设置</div></th>
      </tr>
    <tr>
      <th width="16%" class="spec" scope="row" abbr="Model">计量单位</th>
      <td width="42%"><input name="unit" type=text id="unit" size=23 maxlength="10">
        <font color=red>*</font></td>
      <td width="16%">操作员</td>
      <td width="26%"><input name="caozuoyuan" type=text id="caozuoyuan" value="" size=23 maxlength="50">
        <font color=red>*        
        </font></td>
    </tr>
    <tr>
      <th scope="row" abbr="G5 Processor" class="specalt">备注信息</th>
      <td colspan="3" class="alt"><textarea name="beizhu" cols="62" rows="5" id="beizhu"></textarea>
        <font color=red>*</font></td>
      </tr>
  </table>
  <font color=red>*</font>必须填写&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value="输入">&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="返回" onClick="javascript:window.location.href='unit_list.asp';">
</form>
</center>
 
<%
end if
%>
         </td>
            
          <td background="<%=imgpath%>images/j5.gif" width=19 height=280></td>
          </tr>
        </table>
    </tr>
    <tr>
      <td height=19>&nbsp;      </td>
    </tr>
  </table>
  
<%
%>
</body>
</html>
搜索更多相关主题的帖子: SQL 数据库 表单 名字 页面 
2008-09-23 15:23
mafuyu
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-9-23
收藏
得分:0 
在线等,哪位高手给解决一下啊?谢谢了
2008-09-23 15:50
快速回复:求助!怎么在添加页面表单中调用SQL数据库中其他表中的用户登陆名字
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026738 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved