发货编号生成问题
<%
//发运销子第 生成
Function nextPH()
Dim strResult, temp
strResult = ""
temp = "000001"
//Dim thedb As Database
//Set thedb = DBEngine.Workspaces(0).Databases(0)
if month(date()) >= 10 then
NowMonth=month(date())
else
NowMonth="0"&month(date())
end if
if day(date()) >= 10 then
NowDay=day(date())
else
NowDay="0"&day(date())
end if
SQL1 = "select count(fCode) AS fCodeCount from fyorder WHERE fCode like ' % " & year(date())&NowMonth&NowDay & " % '"
SQL2 = "select MAX(fCode) AS fCodeMax from fyorder WHERE fCode like ' % " & year(date())&NowMonth&NowDay & " % '"
//Set rs1 = thedb.OpenRecordset(SQL1)
//set rs1=conn.execute(SQL1)
set rs1 =Server.CreateObject("ADODB.RecordSet")
//rs_as.open SQL,connServer,1,3
rs1.open SQL1,conn,1,1
//先查找当天是否有流水号
If Not rs1.EOF Then
%>
<script language="javascript">
alert(<%=rs1.Fields("fCodeCount")%> +'roch')
</script>
<%
If rs1.Fields("fCodeCount") > 0 Then
response.write rs1.Fields("fCodeCount") //Set rs2 = thedb.OpenRecordset(SQL2) rs_Roch.recordcount
%>
<script language="javascript">
alert(<%=rs1("fCodeCount")%>)
</script>
<%
//rs2.open SQL2,conn,1,3
//Set rs2 = thedb.OpenRecordset(SQL2)
set rs2=conn.execute(SQL2)
//从数据库中得到当天的流水号的最大值
%>
<script language="javascript">
alert(<%=rs2("fCodeMax")%>)
</script>
<%
If not rs2.EOF Then
//流水号加1后从右截取6位字符串
//strResult = Format(Date, "yyyymmdd") & Right((CLng("1000001") + Right(temp, 6)), 6)
%>
<script language="javascript">
alert(<%=rs2("fCodeMax")%>)
</script>
<%
strResult = year(date())&NowMonth&NowDay & Right( (CLng("1000001") + Right(rs2("fCodeMax"), 6)), 6)
response.write rs2("fCodeMax")
End If
Else
strResult = year(date())&NowMonth&NowDay & "000001"
End If
End If
nextBH = strResult
End Function
%>
If rs1.Fields("fCodeCount") > 0 Then 到这就卡住了 我的记录结果明显是>0 可是不管怎么返回的结果都是0 ,请赐教