关于一个复杂表单提取的问题

wangfang 2000-11-10 11:11:00
我遇到这样一个问题,我有一个文件叫reg.asp,是供用户注册用的,我的数据库的table名字叫register,里面有三个字段,第一个字段是用户名(username),第二个字段为一个列表选项(club),要求从register里面列出,即register里面有几个不同的club,就显示几个,假设register里面有三个不同的club(ACBL,ABC,Other),因为用户所在的club不一定就是registe里面列出的club,所以我在register特意加了一个other,以便将用户填写的club加到register里面去。如此当第一个用户进入reg.asp页面的时候,这个club显示出来的就只有三个(ACBL,ABC,Other)。

现在我要做的事是:当用户选other的时候,就到另外一个页面(如club.asp)填写这个俱乐部的名字,填完以后重新回到reg.asp页面,再填写第三个字段Email,然后一起把这些信息提交到register,这样的话我的table里面的第二个字段club就可能多了一个,下次当第二个用户进入到reg.asp页面的时候,看到的将可能是四个选项,请问如何做到这一点。我用的数据库是sql server.这个问题可能有点复杂,请高手大虾们指点,最好有源代码提供。
...全文
278 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
hades 2000-11-14
  • 打赏
  • 举报
回复
我给你一段CODE,是可以用的,你看看里面的LIST调用
(注意:LIST要用ACTIVEX控件里的ComboBox)
<%@ Language=VBScript %>
<%
Dim userId
userId = Session("userId")
%>

<%
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "SMEDB", "sa", ""

Set rsKw = Server.CreateObject("ADODB.Recordset")
sql = "SELECT cwh, ccmc FROM qx_cwb WHERE rydm='"& userId &"' and qxz like '___0__'"
rsKw.Open sql, DataConn, 2, 4
%>

<%
Dim bError
bError = 0

If rsKw.BOF or rsKw.EOF Then
bError = 1
Else
Dim iCount
iCount = 0
rsKw.MoveFirst
Do While not rsKw.EOF
iCount = iCount + 1
rsKw.MoveNext
Loop
End If
%>

<%
Set cmdClerk = Server.CreateObject("ADODB.Recordset")
sql = "Select rydm, xm From rydmb"
cmdClerk.Open sql, DataConn, 3, 4
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<P align=center><FONT size=5>营业日报表</FONT></P>
<hr color="red">
<FORM action="Yy501.asp" method="post" name="frmOrder">
<div align=center>
<TABLE>
<tr>
<td></td>
<td>
<OBJECT classid=clsid:8BD21D30-EC42-11CE-9E0D-00AA006002F3 height=23
id=cboFlag style="HEIGHT: 23px; LEFT: 1px; TOP: 1px; WIDTH: 157px"
width=164><PARAM NAME="VariousPropertyBits" VALUE="746604571"><PARAM NAME="BackColor" VALUE="2147483653"><PARAM NAME="ForeColor" VALUE="2147483656"><PARAM NAME="MaxLength" VALUE="0"><PARAM NAME="BorderStyle" VALUE="0"><PARAM NAME="ScrollBars" VALUE="0"><PARAM NAME="DisplayStyle" VALUE="3"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Size" VALUE="4154;609"><PARAM NAME="PasswordChar" VALUE="0"><PARAM NAME="ListWidth" VALUE="0"><PARAM NAME="BoundColumn" VALUE="1"><PARAM NAME="TextColumn" VALUE="65535"><PARAM NAME="ColumnCount" VALUE="1"><PARAM NAME="ListRows" VALUE="8"><PARAM NAME="cColumnInfo" VALUE="0"><PARAM NAME="MatchEntry" VALUE="1"><PARAM NAME="ListStyle" VALUE="0"><PARAM NAME="ShowDropButtonWhen" VALUE="2"><PARAM NAME="ShowListWhen" VALUE="1"><PARAM NAME="DropButtonStyle" VALUE="1"><PARAM NAME="MultiSelect" VALUE="0"><PARAM NAME="Value" VALUE=""><PARAM NAME="Caption" VALUE=""><PARAM NAME="PicturePosition" VALUE="458753"><PARAM NAME="BorderColor" VALUE="2147483654"><PARAM NAME="SpecialEffect" VALUE="2"><PARAM NAME="Accelerator" VALUE="0"><PARAM NAME="GroupName" VALUE=""><PARAM NAME="FontName" VALUE="宋体"><PARAM NAME="FontEffects" VALUE="1073741824"><PARAM NAME="FontHeight" VALUE="240"><PARAM NAME="FontOffset" VALUE="0"><PARAM NAME="FontCharSet" VALUE="134"><PARAM NAME="FontPitchAndFamily" VALUE="34"><PARAM NAME="ParagraphAlign" VALUE="1"><PARAM NAME="FontWeight" VALUE="400"></OBJECT>
</td>
<td></td>
</tr>
<tr>
<td>选择仓库</td>
<td>
<OBJECT classid="clsid:8BD21D30-EC42-11CE-9E0D-00AA006002F3" id=cboKw style="HEIGHT: 24px; LEFT: 1px; TOP: 1px; WIDTH: 157px">
<PARAM NAME="VariousPropertyBits" VALUE="746604571">
<PARAM NAME="BackColor" VALUE="2147483653">
<PARAM NAME="ForeColor" VALUE="2147483656">
<PARAM NAME="MaxLength" VALUE="0">
<PARAM NAME="BorderStyle" VALUE="0">
<PARAM NAME="ScrollBars" VALUE="0">
<PARAM NAME="DisplayStyle" VALUE="3">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Size" VALUE="4154;635">
<PARAM NAME="PasswordChar" VALUE="0">
<PARAM NAME="ListWidth" VALUE="0">
<PARAM NAME="BoundColumn" VALUE="1">
<PARAM NAME="TextColumn" VALUE="65535">
<PARAM NAME="ColumnCount" VALUE="1">
<PARAM NAME="ListRows" VALUE="8">
<PARAM NAME="cColumnInfo" VALUE="0">
<PARAM NAME="MatchEntry" VALUE="1">
<PARAM NAME="ListStyle" VALUE="0">
<PARAM NAME="ShowDropButtonWhen" VALUE="2">
<PARAM NAME="ShowListWhen" VALUE="1">
<PARAM NAME="DropButtonStyle" VALUE="1">
<PARAM NAME="MultiSelect" VALUE="0">
<PARAM NAME="Value" VALUE="">
<PARAM NAME="Caption" VALUE="">
<PARAM NAME="PicturePosition" VALUE="458753">
<PARAM NAME="BorderColor" VALUE="2147483654">
<PARAM NAME="SpecialEffect" VALUE="2">
<PARAM NAME="Accelerator" VALUE="0">
<PARAM NAME="GroupName" VALUE="">
<PARAM NAME="FontName" VALUE="宋体">
<PARAM NAME="FontEffects" VALUE="1073741824">
<PARAM NAME="FontHeight" VALUE="240">
<PARAM NAME="FontOffset" VALUE="0">
<PARAM NAME="FontCharSet" VALUE="134">
<PARAM NAME="FontPitchAndFamily" VALUE="34">
<PARAM NAME="ParagraphAlign" VALUE="1">
<PARAM NAME="FontWeight" VALUE="400"></OBJECT>
</td>
<td></td>
</tr>
<tr>
<td>产品信息</td>
<td><input name="txtProd"></td>
<td></td>
</tr>
<tr>
<td>员工选择</td>
<td>
<OBJECT classid=clsid:8BD21D30-EC42-11CE-9E0D-00AA006002F3 id=cboClerk
style="HEIGHT: 24px; LEFT: 1px; TOP: 1px; WIDTH: 157px"><PARAM NAME="VariousPropertyBits" VALUE="746604571"><PARAM NAME="BackColor" VALUE="2147483653"><PARAM NAME="ForeColor" VALUE="2147483656"><PARAM NAME="MaxLength" VALUE="0"><PARAM NAME="BorderStyle" VALUE="0"><PARAM NAME="ScrollBars" VALUE="0"><PARAM NAME="DisplayStyle" VALUE="3"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Size" VALUE="4154;635"><PARAM NAME="PasswordChar" VALUE="0"><PARAM NAME="ListWidth" VALUE="0"><PARAM NAME="BoundColumn" VALUE="1"><PARAM NAME="TextColumn" VALUE="65535"><PARAM NAME="ColumnCount" VALUE="1"><PARAM NAME="ListRows" VALUE="8"><PARAM NAME="cColumnInfo" VALUE="0"><PARAM NAME="MatchEntry" VALUE="1"><PARAM NAME="ListStyle" VALUE="0"><PARAM NAME="ShowDropButtonWhen" VALUE="2"><PARAM NAME="ShowListWhen" VALUE="1"><PARAM NAME="DropButtonStyle" VALUE="1"><PARAM NAME="MultiSelect" VALUE="0"><PARAM NAME="Value" VALUE=""><PARAM NAME="Caption" VALUE=""><PARAM NAME="PicturePosition" VALUE="458753"><PARAM NAME="BorderColor" VALUE="2147483654"><PARAM NAME="SpecialEffect" VALUE="2"><PARAM NAME="Accelerator" VALUE="0"><PARAM NAME="GroupName" VALUE=""><PARAM NAME="FontName" VALUE="宋体"><PARAM NAME="FontEffects" VALUE="1073741824"><PARAM NAME="FontHeight" VALUE="240"><PARAM NAME="FontOffset" VALUE="0"><PARAM NAME="FontCharSet" VALUE="134"><PARAM NAME="FontPitchAndFamily" VALUE="34"><PARAM NAME="ParagraphAlign" VALUE="1"><PARAM NAME="FontWeight" VALUE="400"></OBJECT>
</td>
<td></td>
</tr>
<tr>
<td>客户名称</td>
<td>
<input name="txtKH">
</td>
<td></td>
</tr>
<tr>
<td>起始时间:</td>
<td>
<OBJECT classid=clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1 height=25
id=DTPStart style="HEIGHT: 25px; LEFT: 1px; TOP: 1px; WIDTH: 157px"
width=160><PARAM NAME="_ExtentX" VALUE="4154"><PARAM NAME="_ExtentY" VALUE="661"><PARAM NAME="_Version" VALUE="393216"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Enabled" VALUE="1"><PARAM NAME="OLEDropMode" VALUE="0"><PARAM NAME="CalendarBackColor" VALUE="-2147483643"><PARAM NAME="CalendarForeColor" VALUE="-2147483630"><PARAM NAME="CalendarTitleBackColor" VALUE="-2147483633"><PARAM NAME="CalendarTitleForeColor" VALUE="-2147483630"><PARAM NAME="CalendarTrailingForeColor" VALUE="-2147483631"><PARAM NAME="CheckBox" VALUE="0"><PARAM NAME="CustomFormat" VALUE=""><PARAM NAME="DateIsNull" VALUE="0"><PARAM NAME="Format" VALUE="662831105"><PARAM NAME="UpDown" VALUE="0"><PARAM NAME="CurrentDate" VALUE="36526"><PARAM NAME="MaxDate" VALUE="2958465"><PARAM NAME="MinDate" VALUE="-109205"></OBJECT>
</td>
<td></td>
</tr>
<tr>
<td>截止时间:</td>
<td>
<OBJECT classid=clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1 height=26
id=DTPEnd style="HEIGHT: 26px; LEFT: 1px; TOP: 1px; WIDTH: 158px"
width=160><PARAM NAME="_ExtentX" VALUE="4180"><PARAM NAME="_ExtentY" VALUE="688"><PARAM NAME="_Version" VALUE="393216"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Enabled" VALUE="1"><PARAM NAME="OLEDropMode" VALUE="0"><PARAM NAME="CalendarBackColor" VALUE="-2147483643"><PARAM NAME="CalendarForeColor" VALUE="-2147483630"><PARAM NAME="CalendarTitleBackColor" VALUE="-2147483633"><PARAM NAME="CalendarTitleForeColor" VALUE="-2147483630"><PARAM NAME="CalendarTrailingForeColor" VALUE="-2147483631"><PARAM NAME="CheckBox" VALUE="0"><PARAM NAME="CustomFormat" VALUE=""><PARAM NAME="DateIsNull" VALUE="0"><PARAM NAME="Format" VALUE="662831105"><PARAM NAME="UpDown" VALUE="0"><PARAM NAME="CurrentDate" VALUE="36892"><PARAM NAME="MaxDate" VALUE="2958465"><PARAM NAME="MinDate" VALUE="-109205"></OBJECT>
</td>
<td></td>
<tr></tr>
</TABLE>
</div>

<P align=center>
<OBJECT classid=clsid:D7053240-CE69-11CD-A777-00DD01143C57 id=btnView
style="HEIGHT: 32px; LEFT: 0px; TOP: 0px; WIDTH: 126px"><PARAM NAME="ForeColor" VALUE="2147483666"><PARAM NAME="BackColor" VALUE="2147483663"><PARAM NAME="VariousPropertyBits" VALUE="27"><PARAM NAME="Caption" VALUE="查询"><PARAM NAME="PicturePosition" VALUE="458753"><PARAM NAME="Size" VALUE="3334;847"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Accelerator" VALUE="0"><PARAM NAME="TakeFocusOnClick" VALUE="-1"><PARAM NAME="FontName" VALUE="Times New Roman"><PARAM NAME="FontEffects" VALUE="1073741824"><PARAM NAME="FontHeight" VALUE="240"><PARAM NAME="FontOffset" VALUE="0"><PARAM NAME="FontCharSet" VALUE="0"><PARAM NAME="FontPitchAndFamily" VALUE="34"><PARAM NAME="ParagraphAlign" VALUE="3"><PARAM NAME="FontWeight" VALUE="400"></OBJECT>
<OBJECT classid=clsid:D7053240-CE69-11CD-A777-00DD01143C57 height=32 id=btnBack
style="HEIGHT: 32px; LEFT: 0px; TOP: 0px; WIDTH: 127px" width=127><PARAM NAME="ForeColor" VALUE="2147483666"><PARAM NAME="BackColor" VALUE="2147483663"><PARAM NAME="VariousPropertyBits" VALUE="27"><PARAM NAME="Caption" VALUE="返回"><PARAM NAME="PicturePosition" VALUE="458753"><PARAM NAME="Size" VALUE="3360;847"><PARAM NAME="MousePointer" VALUE="0"><PARAM NAME="Accelerator" VALUE="0"><PARAM NAME="TakeFocusOnClick" VALUE="-1"><PARAM NAME="FontName" VALUE="宋体"><PARAM NAME="FontEffects" VALUE="1073741824"><PARAM NAME="FontHeight" VALUE="240"><PARAM NAME="FontOffset" VALUE="0"><PARAM NAME="FontCharSet" VALUE="134"><PARAM NAME="FontPitchAndFamily" VALUE="34"><PARAM NAME="ParagraphAlign" VALUE="3"><PARAM NAME="FontWeight" VALUE="400"></OBJECT>
</P>
</FORM>
</BODY>
<SCRIPT language="VBScript">
<!--
dim b, strRq
dim CustList(<%=(cmdClerk.RecordCount-1)%>)
dim CustBh(<%=(cmdClerk.RecordCount-1)%>)
dim KwList(<%=(iCount-1)%>)
dim McList(<%=(iCount-1)%>)

b = true
strRq = "<%=strTmp%>"

sub window_onfocus()

dim strYear, strMonth, strDay

strYear = Year(Date())
strMonth = Month(Date())
strDay = Day(Date())
strDate = strYear & "-" & strMonth & "-" & strDay

if b then
frmOrder.DTPStart.Value = strDate
frmOrder.DTPEnd.Value = Date()
b = false
end if

end sub

Sub window_onload()

<% If bError = 1 Then %>
msgbox ("您没有查询的权限,请和管理员联系")
<%rsKw.Close%>
<%cmdClerk.Close%>

<%DataConn.Close%>
window.location.href="../main.asp"

<% Else %>
icount= 0

<%rsKw.MoveFirst%>
<%do while not rsKw.eof%>
KwList(icount) = Trim("<%=rsKw("cwh")%>")
McList(icount) = Trim("<%=rsKw("ccmc")%>")
<%rsKw.MoveNext%>
icount = icount + 1
<%Loop%>
frmOrder.cboKw.List = McList
frmOrder.cboKw.Value = Trim(McList(0))

<%rsKw.Close%>

icount= 0
<%cmdClerk.MoveFirst%>
<%do while not cmdClerk.eof%>
CustList(icount) = trim("<%=cmdClerk("xm")%>")
CustBh(icount) = Trim("<%=cmdClerk("rydm")%>")
<%cmdClerk.MoveNext%>
icount = icount + 1
<%Loop%>
<%cmdClerk.Close%>

frmOrder.cboClerk.List = custList
<%DataConn.Close%>

frmOrder.cboFlag.AddItem "全部"
frmOrder.cboFlag.AddItem "记帐"
frmOrder.cboFlag.AddItem "未记帐"

frmOrder.focus ()

<%End If%>
End Sub

sub btnView_click()
Dim strTmp, strFlag, strClerk
Dim strSDate, strEDate
dim strSYear, strSMonth, strSDay
dim strEYear, strEMonth, strEDay

If frmOrder.cboClerk.ListIndex = -1 Then
strClerk = ""
else
strClerk = CustBh(frmOrder.cboClerk.ListIndex)
end if

strSYear = Trim(frmOrder.DTPStart.Year)
strSMonth = Trim(frmOrder.DTPStart.Month)
strSDay = Trim(frmOrder.DTPStart.Day)
strSDate = strSYear & "-" & strSMonth & "-" & strSDay

strEYear = Trim(frmOrder.DTPEnd.Year)
strEMonth = Trim(frmOrder.DTPEnd.Month)
strEDay = Trim(frmOrder.DTPEnd.Day)
strEDate = strEYear & "-" & strEMonth & "-" & strEDay

strTmp = Trim(frmOrder.cboFlag.Value)

strKw = Trim(KwList(frmOrder.cboKw.ListIndex))

If strTmp = "全部" Then
strFlag = "3"
Else If strTmp = "记帐" Then
strFlag = "0"
Else
strFlag = "1"
End If
End If

If strTmp = "" Then
strFlag = "3"
End If

frmOrder.action = "Yy501.asp?flag="&strFlag&"&SDay="&strSDate&"&EDay="&strEDate&"&Clerk="&strClerk&"&kw="&strKw
frmOrder.submit

end sub

sub btnBack_click()
window.location.href ="../submenu500.asp"
end sub
-->
</SCRIPT>
</HTML>
wangfang 2000-11-13
  • 打赏
  • 举报
回复
linyu,你说的第一步我已经做到了,现在我假设要输入club的详细信息,clubname,ClubAddress,Chairman,Email Address
URL Website,你说在注册页面加一个文本框,怎么行呢?本人是一个新手,能不能把你说的第二步代码详细一点写给我,要求包括上述详细信息,拜托?
hades,你说的东西能不能写详细一点,完整一点,最好从头到尾写一遍。谢谢你给我答复。本人比较愚钝,另外我在执行Dim aClub(rsMain.count-1)时有这样的错误发生"缺少整型常量",是不是写错了,还是别的什么原因?
wangfang 2000-11-13
  • 打赏
  • 举报
回复
真的就没有人能回答我的问题吗?如此太令我失望了!
wangfang 2000-11-13
  • 打赏
  • 举报
回复
各位大虾们,可不要见死不救啊!我现在想这样做 :在注册页面上,club选项可以从表bridgeclub动态取出,这个表中含clubname,ClubAddress,Chairman,Email Address这些字段,我自己在后面加了手工加了一个other选项,目的是想用户点击other选项,进入club.asp,填完信息后又返回datalist.asp,但是新问题来了,返回是返回了,但是现在出现了两个datalist.asp窗口,先前的保存有username信息的datalist.asp窗口在后面,后来返回的datalist.asp窗口变得跟club.asp窗口一样大小,而且先前输入的如username的信息也不见了,更不用说输入的club名字了,我现在想关闭一个后面的datalist.asp窗口,留一个保存有username,club信息的窗口,请问如何做?<html>
我的几个源程序如下:

'datalist.asp注册页面
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>New Page </title>
</head>

<body>

<form method="post" action="writeinfo.asp" name="form1">
<p>username:<input type="text" size="20" name="username"
value="<%=request.cookies("username")%>"> <%set connection=Server.createobject("ADODB.Connection")
connection.open "dsn=bridge;uid=sa;"
Set rs = connection.Execute("Select clubname from bridgeclub")

%> </p>
<p><select size="1" name="club" onchange="changeclub(this.form)">
<%do until rs.eof%> <option><%=rs("clubname")%></option>
<%rs.movenext%><%loop%> <option value="Other">Other</option>
</select></p>
<p>email:<input type="text" size="20" name="email" value="<%=request.cookies("email")%>"></p>
<p><input type="submit" value="submit"><input type="reset" value="reset"> </p>
</form>
</body>
</html>
<script language="javascript">
<!--
function changeclub(form)
{

if(form.club.value=="Other")
{
window.open("club.asp","main","width=600,height=400,left=100,top=150,toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
}
}
-->
</script>


'club.asp输入俱乐部信息
<html>

<head>
<title>club</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<body topmargin="0" marginheight="0" leftmargin="0" marginwidth="0">

<form name="mainform" action="writeclub.asp" method="post" align="center">
<div align="center"><center><table border="0" cellPadding="1" cellSpacing="0" width="547"
bgColor="#ffcc00">
<tr>
<td bordercolor="#ffcc00"><table border="0" cellPadding="0" cellSpacing="0" width="100%"
bgcolor="#ffffff">
<tr bgColor="#ffcc00">
<td bgColor="#ffcc00" rowSpan="11" width="1" height="20"></td>
<td width="538" valign="center" align="left" height="20"><font color="#000000"
face="arial" size="4"><b>  Club information</b></font></td>
<td height="20" vAlign="center" align="left" width="8"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><table border="0" cellPadding="0" cellSpacing="0" width="100%" bgcolor="#ffffff">
<tr>
<td colSpan="2" width="538" height="19"><font face="Verdana, Arial, Helvetica,sans-serif"
size="2">please enter your club  information here. Areas marked with a red 
asterisk (</font><font color="red">*</font><font
face="Verdana, Arial, Helvetica,sans-serif" size="2">) required information.</font></td>
</tr>
<tr>
<td colSpan="2" width="538" height="15">  </td>
</tr>
<tr>
<td align="right" width="192" height="12"><font face="arial" size="2">ClubName: </font></td>
<td align="left" width="344" height="12"><input maxLength="50" name="Club" size="22"><font
color="red">*</font><font face="Verdana, Arial, Helvetica,sans-serif" size="1">(4~30
characters)</font></td>
</tr>
<tr>
<td colSpan="2" height="10" width="561">  </td>
</tr>
<tr>
<td bgColor="#ffcc00" colSpan="2" height="10" width="561"></td>
</tr>
<tr>
<td bgColor="#ffcc00" colSpan="2" height="10" width="561"></td>
</tr>
</table>
</td>
</tr>
</table>
</center></div><p><br>
</p>
<div align="center"><center><table border="0" cellpadding="0" cellspacing="1" width="30%">
<tr>
<td width="33%"><input type="submit" value=" OK "></td>
<td width="33%"><input type="reset" Value="Reset"> </td>
<td width="33%"></td>
</tr>
</table>
</center></div>
</form>
</body>
</html>

writeclub.asp把信息写入表bridgeclub
<%

club=Request.Form("club")


Dim tmpSet

set connection=Server.createobject("ADODB.Connection")
connection.open "dsn=bridge;uid=sa"
Set tmpSet = connection.Execute("Select * from register where club = '" &club& "'")
if tmpset.eof then
SQLStmt="insert into bridgeclub(clubname) values('" &club & "')"

connection.execute(sqlstmt)

tmpSet.close
connection.close



response.redirect "datalist.asp"
%>
<%
Else
tmpSet.close
connection.close

%>
<html>

<head>
<title>Write Information</title>
</head>

<body>

<p>The club has been used by others,please <a href="club.asp">return</a> to register again
! <% End If
%> </p>
</body>
</html>
writeinfo.asp把注册信息写入表register
<%

UserName=Request.Form("username")
club=request.form("club")

Email=request.form("email")

Dim tmpSet

set connection=Server.createobject("ADODB.Connection")
connection.open "dsn=bridge;uid=sa"
Set tmpSet = connection.Execute("Select * from register where UserName = '" &UserName & "'")
If tmpSet.Eof Then
SQLStmt = "Insert Into register(Status,FirstName,LastName,UserName,PassWord,club,Email) Values('1','1234','1234','"&UserName&"','1234','"&club&"','"&email&"')"


connection.execute(sqlstmt)


Session("username") =UserName
Session("password")=PassWord
response.redirect "successguest.asp"
%>
<%
Else
tmpSet.close%>
<html>

<head>
<title>Write Information</title>
</head>

<body>

<p>The username has been used by others,please <a href="datalist.asp">return</a> to
register again ! <% End If
%> </p>
</body>
</html>



hades 2000-11-12
  • 打赏
  • 举报
回复
right,
linyu的回复,就是我的意识
BUT,OUHER还是在表里有记录为好,这样写的更有完整性

to wangfang:
我上面的CODE里没写函数调用,
window_onload函数是加载window的时候调用的,作用是从数据表里提记录来填充list,
而btnSure_onClick函数(Sorry, 这里函数名写错了),是对应页面上的Button的。
注意:button的name为"btnSure"
这样的方法是可行的,因为我已经不止写过一两次的
ASP报错,你可以通过错误信息来改正CODE,
或,把错误信息告诉我
linyu 2000-11-12
  • 打赏
  • 举报
回复
你的问题应该分为二部份:
1.从库中取出不同的CLUB值,动态生成填表的选项,这个可以使用sql语句中select distinct从表中取出不用的CLUB值来动态生成SELECT的选项,这里要注意,other是不用放在表中的,可以直接在ASP中加上。
2.在注册页面上增加一个otherclub文本框,如果用户选择other,CLUB值去取otherclub文本框的值就可以了,不用到另外一页,你只要判断当CLUB选择框是OTHER时,otherclub文本框的值不能为空就可以了,在接受页插入纪录前,判断CLUB的值如果是other,就使用otherclub文本框的值就可以了。
hades 2000-11-11
  • 打赏
  • 举报
回复
写的冲忙,有几个小错误,不过不伤皮毛的。
:>>>>>
hades 2000-11-11
  • 打赏
  • 举报
回复
添加Active控件ComboBox. 假设name定为cboClub.

Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "DSN Name", "User Name", "Password"
Set rsMain = Server.CreateObject("ADODB.Recordset")
sql = "SELECT club FROM registr"
rsMain.Open sql, DataConn, 2, 4

.
.
.

<Script Language="VBScript">
<!--
'定义数组,如有三条记录,则aClub(2)...
Dim aClub(rsMain.count-1)

sub window_onload
if rsMain.EOF or rsMain.BOF then
'没有记录
'添加出错处理
else
i = 0
rsMain.MoveFirst
do while not rsMain.EOF
aClub(i) = Trim(rsMain("club"))
i = i + 1
next
'用数组填充控件List
window.cboClub.list = aClub

end sub

'如果选择是other
sub btnSure
if window.cboClub.Value = "Other" Then
window.location.href = "club.asp"
end if
end sub
-->
</Script>
你可以用这个思路来写。
我不写JavaScript的code了,方法是一样的。
具体还时你自己写,这样提高的快
Good Lock :)
wangfang 2000-11-11
  • 打赏
  • 举报
回复
我试了一下,不行啊,而且函数调用也没有,运行时也有错误发生,请写仔细点,好吗?
wangfang 2000-11-10
  • 打赏
  • 举报
回复
现在我假设要输入club的详细信息,如ClubName,ClubAddress,Chairman,Email Address
URL Website,那又怎么办呢?在一个form里面把这些都列出来,这样不是不可以,只是不太好,所以我想把这些信息放在另外一个页面club.asp里面提交,请问又如何解决?谢谢!
Edward 2000-11-10
  • 打赏
  • 举报
回复
我想不用那么麻烦。在同一个页面的 form 上,再多加一个 <input type=text name=txtNewClub> 的东东,并注明,如果用户的 club 不在列表框中,请在此输入。表单提交的时候,做一下适当判断,如果 txtNewClub 的值不为空,就存入相应的数据表。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧