<!--#include file="conn.asp"-->
<%
function zint(str)
dim i
dim a
dim b
dim c
c=0
b=0
for i=1 to len(str)
a=mid(str,i,1)
c=asc(a)-48
b=b*10+c
next
zint=b
end function
if request.Form("phone")="" then
response.redirect"admin_cardsadd1.asp?msg=你没有输入电话号码,请重新操作!!!"
end if
dim text,checknum
text="0123456789"
for i=1 to len(request.form("phone"))
checknum=instr(1,text,mid(request.Form("phone"),i,1))
if checknum=0 then
response.redirect"admin_cardsadd1.asp?msg=你输入的电话号码中有字母或其他字符,请检查重新输入!!!"
exit for
end if
next
if len(trim(request.form("phone")))=11 then
if checknum<>0 then
dim ph_time1,ph_type,ph_brand,m_id,ph_no,aphone
ph_brand=request.Form("brand")
ph_noduan=request.Form("noduan")
ph_time1=date
ph_no=request.Form("phone")
ph_type="普通号"
aphone="aphone"+ph_noduan
if request.Form("phone")<>"" then
set rsid=server.CreateObject("adodb.recordset")
strsql1="select lid from "&aphone&""
id1=0
rsid.open strsql1,conn,2,3
' set rsid=conn.execute("select * from "&aphone&"")
rsid.movelast
'id1=rsid.recordcount+id1
id1=rsid("lid")
id1=int(id1)+1
set rs=server.CreateObject("adodb.recordset")
' strsql="select * from "&aphone&""
dim rs,strsql
set rs=server.CreateObject("adodb.recordset")
strsql="insert into "&aphone&"(lid,ph_no,ph_brand,ph_type,ph_time1,m_id) values("&id1&",'"&ph_no&"','"&ph_brand&"','"&ph_type&"','"&ph_time1&"','"&m_id&"')"
conn.execute(strsql)
'response.Write aphone
'response.Write rs("ph_no")
' rs.addnew
' rs("ph_no")=ph_no
'rs("id")=id1
'rs("ph_brand")=ph_brand
'rs("ph_type")=ph_type
'rs("ph_time1")=ph_time1
' rs("m_id")=1
'rs.update
if conn.errors.count=0 then
response.write("<Script language='javascript'>alert('添加成功');location.href=('admin_cardsadd1.asp');</Script>")
end if
rs.close
set rs=nothing
else
response.redirect"admin_cardsadd1.asp?msg=发生错误请检查再重新执行操作!!!"
rs.close
set rs=nothing
end if
end if
else
response.write"输入的电话号码的个数少于11位!"
end if
现在已经好了 .我们发现是我们是在主健的数据类型上没弄好.
我们用C语言的算法 用VB的编写的.这个函数大家回用的上.送给大家了.