access库的是/否字段类型,显示时为False和True,怎样让对的False和True显示时为否和是?

ready 2001-06-21 09:53:00
...全文
502 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
11830 2001-06-21
  • 打赏
  • 举报
回复
你这样试试,你为所有的 checkbox 的 name值都设为一样的 ,如 mybook然后将它们的value设置为记录的id号
在 save.asp中这样写
mybook=request("mybook")
if instr(mybook,",")>0 then
splmybook=split(mybook,",")
for i=0 to ubound(splmybook)-1
sqlsave = "update shenpi set report_book = '"&report_book&"' where id = "&id&""
cn.Execute(sqlsave)
next
end if
ready 2001-06-21
  • 打赏
  • 举报
回复
还是出现数组索引越界错误.
11830 2001-06-21
  • 打赏
  • 举报
回复
这句有问题
for i = 1 to Request.Form("id").Count
改为
for i = 0 to Request.Form("id").Count-1

for i = 1 to Request.Form("id").Count-1
试试
ready 2001-06-21
  • 打赏
  • 举报
回复
我改成了文本型字段。下面是我的程序,但出现错误类型:数组索引越界。这是怎么回事?

index.asp页:
<%
dbpath = "driver={microsoft access driver (*.mdb)}; dbq=" & server.MapPath("../../database.mdb")
set cn = server.CreateObject("adodb.connection")
cn.Open dbpath
sqlshow = "select * from shenpi"
set rs = cn.Execute(sqlshow)
Response.Write "<form method=post action=save.asp>"
while not rs.eof
if IsEmpty(rs("report_book")) or rs("report_book") = "" then
Response.Write "<input type=checkbox name=report_book value='是'>"
else
Response.Write "<input type=checkbox name=report_book checked value='是'>"
end if
Response.Write "<input type=hidden name=id value=" & rs("id") & ">"
rs.movenext
wend
Response.Write "<input type=submit value=submit>"
Response.Write "</form>"
%>

save.asp页:
<%
dbpath = "driver={microsoft access driver (*.mdb)}; dbq=" & server.MapPath("../../database.mdb")
set cn = server.CreateObject("adodb.connection")
cn.Open dbpath
for i = 1 to Request.Form("id").Count
id = request("id")(i)
report_book = Request.Form("report_book")(i)
sqlsave = "update shenpi set report_book = '"&report_book&"' where id = "&id&""
cn.Execute(sqlsave)
next
%>

11830 2001-06-21
  • 打赏
  • 举报
回复
我试过不行的
ready 2001-06-21
  • 打赏
  • 举报
回复
能否在库中就对其进行指定?
11830 2001-06-21
  • 打赏
  • 举报
回复
在输入显示时判断一下然后写出要显示的值.....
happy7 2001-06-21
  • 打赏
  • 举报
回复
关注
ready 2001-06-21
  • 打赏
  • 举报
回复
no,no.不是用option.需要用checkbox.
最好帮忙看看最上面那段程序,用什么总是引起数组索引越界错误。
西门吹雪 2001-06-21
  • 打赏
  • 举报
回复
myfile=rs("myfile")
....
<option value="<%=myfile%>" <%if myfile=True then%>selected<%end if%>>是</option>
<option value="<%=myfile%>" <%if myfile=False then%>selected<%end if%>>否</option>
...

西门吹雪 2001-06-21
  • 打赏
  • 举报
回复
myfile=rs("myfile")
....
<option value="<%=myfile%>" <%if myfile=True then%>selected>是</option>
<option value="<%=myfile%>" <%if myfile=False then%>selected>否</option>
...
ready 2001-06-21
  • 打赏
  • 举报
回复
你可能还没太明白我要实现的目的。
在index.asp中的是把数据库中的数据用checkbox来显示,如果为"是"则checkbox为选中状态,如果为空,则为未选中状态。然后可以改变checkbox的选中或未选中的状态,把结果再保存回原来的记录中,选中的在库中的记录为是,未选中的在库中的记录为空。

28,407

社区成员

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

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