Here in this code we have used CInt before Session,If we wont use CInt the code doesn't work in the intended way....and using CInt sometimes gives error..It works for 1 day & the other day shows error...What & why is this problem?? Is there any alternative for "CInt" or we ll hv to include any file..
Please Help !
Expand|Select|Wrap|Line Numbers
- <%@ language=VBScript%>
- <% option explicit %>
- <!--#include virtual="/adovbs.inc"-->
- <HTML>
- <BODY>
- <form method=post action="z2.asp">
- Name:<input type=text name=name value=<%=Session("name")%>><BR>
- Password:<input type=password name=pwd>
- <BR>
- <%
- Response.Write CInt(Session("age"))
- %><BR>
- Age:<select name=age>
- <%
- Dim objConn
- Set objConn=Server.CreateObject("ADODB.Connection")
- objConn.ConnectionString="DSN=Info.dsn;uid=vini;pwd=vini"
- objConn.Open
- Dim sql
- sql="SELECT * FROM age"
- Dim objRS
- Set objRS=Server.CreateObject("ADODB.Recordset")
- objRS.Open sql,objConn
- Dim i
- i=CInt(Session("age"))
- Do while not objRS.EOF
- If i=CInt(objRS("num")) Then
- Response.Write "<option value=" & objRS("num")& " selected>"
- Response.Write objRS("age") & "</option>"
- Else
- Response.Write "<option value=" & objRS("num") & ">"
- Response.Write objRS("age") & "</option>"
- End If
- objRS.MoveNext
- Loop
- objRS.Close
- Set objRS=Nothing
- objConn.Close
- Set objConn=Nothing
- %>
- </select>
- <input type=submit>
- </form>
- </BODY>
- </HTML>