ASP自动生成编码搞不定啊!!高手请!!

来源:百度知道 编辑:UC知道 时间:2024/05/17 06:13:30
<html>
<head>
<title> 生成代码</title>
</head>
<%
set conn=server.createobject("adodb.connection")
DB_ConnStr = "PROVIDER=SQLOLEDB.1;Data Source=(local);Initial Catalog=iqiaqia;Persist Security Info=True;User ID=sa;Connect Timeout=30"
conn.open DB_ConnStr
function sss()
bhid=sss200608101456 ' 定义编号
for i = 1 to 1000 ' 循环100次
exec="insert into bh (bhid) values ('" & bhid & "')" '向表 bh 的 bhid字段插入数据
conn.execute(exec)
《14行》bhid=cstr(left(bhid,11))+cstr(int(right(bhid,4))+1) '取BHID的前11位 和后4位的整数+1 然后相加的字符串
next
end function
%>
<body>
<%call sss()%>
</body>
</html>
错误类型:
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: '[string: ""]'
/iqiaqia/code.asp, 第 14 行
我改成了bhid=clng(left(bhid,11))+(clng(right(bhid,4))+1) 也不行啊!

bhid=200608101456 ' 前面那三个 s 是怎么回事 ...?

for i = 1 to 100 ' 循环100次 / 一百还是一千 ...?

bhid=left(cstr(bhid),11)+cstr(int(right(bhid,4))+1) '取BHID的前11位 和后4位的整数+1 然后相加