Function ProProductId()    
    set rs=server.createobject("adodb.recordset")
sql = "select max(Product_id) as proid from Products"
rs.open sql,conn,1,1
product_id=rs("proid")

if product_id="" then
   product_id=1000
else 
   product_id=product_id+1
end if
ProProductId=product_id

'response.Write(ProProduct_id)  这一句有正确得到数值
rs.close
set rs = null
end Function一下调用却不能出现结果
<%
x=ProProductId()
response.Write(x)
%>
大家帮忙看看

解决方案 »

  1.   

    Function ProProductId()
        Dim Rs
        Dim Sql
        Dim Product_Id
        Set Rs = Server.CreateObject("adodb.recordset")
        Sql = "select Max(Product_id) as proid from Products"
        Rs.Open Sql, Conn, 1, 1
        If IsNull(Rs("proid")) Then
           Product_Id = 1000
        Else
           Product_Id = Rs("proid") + 1
        End If
        ProProductId = Product_Id
        Rs.Close
        Set Rs = Nothing
    End Function
      

  2.   

    按理说没什么问题
    <% 
    x=ProProductId() ‘你在这里看看数值有没有传递过来就是了
    response.Write(x) 
    %>
      

  3.   

    x=ProProductId()
    x为多少啊?