高分求助,分不够可以再加!!!!

wu621 2004-07-06 02:17:44
<%@ Language="VBScript" %>
<% Response.Buffer=True %>
<%
dim mode
mode=Request.Form("ButAdd")
if mode="ButAdd" then
ID=Request.Form("TxtID")
FirstName=Request.Form("TxtFirstName")
LastName=Request.Form ("TxtLastName")
if not isnumeric(ID) then
%>
<script language=vbscript>
msgbox "ID must be number"
</script>
<%
Txt_ID.value=""
end if
end if
'****************************************************
'**************Built Connection**********************
'****************************************************
set conn=server.CreateObject ("adodb.connection")
conn.Open "driver={SQL Server};server=(local);UID=sa;PWD=;database=northwind"
set rs=server.CreateObject("ADODB.Recordset")
'***************************************************
'*************read database*************************
'***************************************************
rs.Open "Select EmployeeID,FirstName,LastName,City From Employees order by EmployeeID" ,conn,1,1
if rs.EOF and rs.BOF then
Response.Write"no record at all"
end if
Response.Write "<table border=10 cellspacing=5>"
Response.Write "<tr>"
for i=0 to rs.Fields.Count-1
Response.Write "<td align=center> <font color=blue>"&rs.Fields(i).Name&"</font></td>"
next
Response.Write "</tr>"
while not rs.EOF
Response.Write "<tr>"
for i=0 to rs.Fields.Count-1
Response.Write "<td align=center>"&rs.Fields(i).Value&"</td>"
next
Response.Write "</tr>"
rs.MoveNext
wend
Response.Write "</table>"
rs.close
'****************************************************
sub insertable()
rs.Open "INSERT INTO Employees(EmpolyeeID,LastName,FirstName) Value ('"&ID&"','"&LastName&"','"&FirstName&"')",conn,1,2
rs.update
end sub
'*****************************************************
if mode="ButAdd" then
call insertable()
Response.Write "insert ok !"
end if
set rs=nothing
set conn=nothing
%>
<HTML>
<HEAD>
<%'*******************************************%>
<TITLE></TITLE>
<script language=vbscript>
function clickit(flag)
if flag=1 then
if form1.TxtID.value="" then
MsgBox "ID can not empty !"
end if
if form1.TxtFirstName.value="" then
MsgBox "FirstName can not empty !
end if
if form1.TxtLastNaem.value="" then
MsgBox "LastName can not empty !"
end if
end if
form1.submit()
end function
</script>
</HEAD>
<BODY>
<form method=post name=form1>
<%'******************************%>
<P align=center></P>
<P align=center>
<LABEL>ID:</LABEL><INPUT id=Txt_ID name=TxtID style="HEIGHT: 22px; LEFT: 375px; TOP: 102px; WIDTH: 102px">
        FirstName:
<INPUT id=Txt_FirstName name=TxtFirstName style="HEIGHT: 22px; LEFT: 375px; TOP: 102px; WIDTH: 102px">
         LastName:
<INPUT id=Txt_LastName name=TxtLastName style="HEIGHT: 22px; LEFT: 375px; TOP: 102px; WIDTH: 102px"> </P>
<P align=center><FONT color=paleturquoise><INPUT id=But_Add name=ButAdd onclick=clickit(1) style="WIDTH: 100px" type=button value=Add vspace=80 width="100">   
<INPUT id=But_Del name=ButAdd type=button value=Delete onclick="click(2)" style="WIDTH: 100px">
        </FONT>
</P>
</form>
</BODY>
</HTML>
点击AddButton这么没有反应!!!急哭了!!!
...全文
45 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
m1_1m 2004-07-06
  • 打赏
  • 举报
回复
<INPUT id=But_Add name=ButAdd onclick=clickit('1') style="WIDTH: 100px" type=button value=Add vspace=80 width="100
<INPUT id=But_Del name=ButAdd type=button value=Delete onclick="click('2')" style="WIDTH: 100px">

而且两个名name=ButAdd 都一样了name=ButAdd
把一个改为 name=ButAdd1

28,390

社区成员

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

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