当表单提交时自动将记录号加1保存,怎么总提示错误???

xuallen 2003-08-21 10:28:09
我想实现当北京录入人员登录并保存记录时,那么记录号自动存为BJ0000001
上海录入人员登录并保存记录时,那么记录号自动存为SH0000001
以后自动按此规则加1。
提交时总提示:
tmpMaxID=right(MaxIDrs(0),7)+1
类型不匹配: '[string: " "]'

select case Session("Location")
case BJ
strCity="BJ"
case SH
strCity="SH"
end select

strMaxID="select Max(Record) from tblInfo where Location='"&Session("Location")&"'"
set MaxIDrs=conn.execute(strMaxID)
if isNULL(MaxIDrs(0)) then
MaxID="0000001"
else
tmpMaxID=right(MaxIDrs(0),7)+1
select case len(tmpMaxID)
case 1
MaxID="000000" & tmpMaxID
case 2
MaxID="00000" & tmpMaxID
case 3
MaxID="0000" & tmpMaxID
case 4
MaxID="000" & tmpMaxID
case 5
MaxID="00" & tmpMaxID
case 6
MaxID="0" & tmpMaxID
case 7
MaxID=tmpMaxID
end select
end if
Session("MaxID")= strCity & MaxID
...全文
28 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
phoenix8122 2003-08-22
  • 打赏
  • 举报
回复
分开号码,自增加以后再合并
laers 2003-08-22
  • 打赏
  • 举报
回复
可能是数据库的问题吧..在你取得数据为空值的时候,会出现这种情况,我昨天也出现过这种

情况/
ymeik 2003-08-22
  • 打赏
  • 举报
回复
dim temp
temp=clng(right(MaxIDrs(0),7))+1
Session("MaxID")= strCity & cstr(temp)
changechange 2003-08-22
  • 打赏
  • 举报
回复
select case Session("Location")
case BJ
strCity="BJ"
case SH
strCity="SH"
end select

strMaxID="select Max(Record) from tblInfo where Location='"&Session("Location")&"'"
set MaxIDrs=conn.execute(strMaxID)
if isNULL(MaxIDrs(0)) then
MaxID="0000001"
else
MaxID=right("000000" & trim(cstr(clng(right(MaxIDrs(0),7))+1)),7)
end if
Session("MaxID")= strCity & MaxID
changechange 2003-08-22
  • 打赏
  • 举报
回复
select case Session("Location")
case BJ
strCity="BJ"
case SH
strCity="SH"
end select

strMaxID="select Max(Record) from tblInfo where Location='"&Session("Location")&"'"
set MaxIDrs=conn.execute(strMaxID)
if isNULL(MaxIDrs(0)) then
MaxID="0000001"
else
tmpMaxID=right("000000" & trim(cstr(clng(right(MaxIDrs(0),7))+1)),7)
end if
Session("MaxID")= strCity & MaxID
pp4u 2003-08-22
  • 打赏
  • 举报
回复
tmpMaxID=right(MaxIDrs(0),7)+"1"
hzqq 2003-08-22
  • 打赏
  • 举报
回复
MaxID=clng(right(MaxIDrs(0),7))+1
Session("MaxID")= strCity & cstr(MaxID)
wjh6of6agriculture 2003-08-21
  • 打赏
  • 举报
回复
0000001这是字符啊!怎么可能当数字加1呢?
xuallen 2003-08-21
  • 打赏
  • 举报
回复
可是为什么提交后能保存0000001,0000002......这样的记录但是不能保存为BJ0000001这样呀?Session("MaxID")= strCity & MaxID中strCity不起作用呀?
hzqq 2003-08-21
  • 打赏
  • 举报
回复
tmpMaxID=right(MaxIDrs(0),7)+1
right()是字符型的,且有7位
要用clng()来强制转换
xuallen 2003-08-21
  • 打赏
  • 举报
回复
系统提示类型不匹配: 'cint'
本拉灯 2003-08-21
  • 打赏
  • 举报
回复
tmpMaxID=right(MaxIDrs(0),7)+1
这句改成
tmpMaxID=cint(right(MaxIDrs(0),7))+1

28,390

社区成员

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

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