I have Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "d-03-07, 0"]'
/OnlineLIB/BNosearch1.asp, line 32
The error happened at this line:bookno = chr(bookno)
The code like this:
Expand|Select|Wrap|Line Numbers
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
- <!--#include file="Connections/Dcon.asp" -->
- <%
- Dim empno, dept, bookno, bookname, issuedate, returndate
- Dim Recordset1, Recordset2
- Dim Recordset1_numRows
- Set Conn = Server.CreateObject("ADODB.Connection")
- 'Conn.open "DSN=MQIS"
- Conn.open "Driver={SQL Server};Server=KBLPC027;Database=libraryinfo;Trusted_Connection=Yes;"
- 'Conn.open "Initial Catalog=lib;Data Source=KBLPC107;Integrated Security=SSPI"
- 'Conn.open "Driver={SQL Server};Server=KBLPC107;Database=lib;Uid=sa;Pwd=;"
- %>
- <%
- Set Recordset1 = Server.CreateObject("ADODB.Recordset")
- Recordset1.ActiveConnection = MM_Dcon_STRING
- Recordset1.Source = "SELECT * FROM dbo.transact"
- Recordset1.CursorType = 0
- Recordset1.CursorLocation = 2
- Recordset1.LockType = 1
- Recordset1.Open()
- Recordset1_numRows = 0
- '----- Populate If Posted any Data
- bookno = Request.Form("book_no")
- 'search = Request.Form("search")
- If bookno = "" Then
- bookno = 0
- Else
- bookno = chr(bookno)
- End If
- If bookno = 0 Then
- empno = ""
- dept = ""
- bookname = ""
- issuedate = ""
- returndate = ""
- Else
- Set Recordset2 = Server.CreateObject("ADODB.Recordset")
- Set Recordset2 = conn.Execute("SELECT * FROM transact WHERE book_no = " & bookno)
- If Recordset2.BOF = True Then
- empno = ""
- dept = ""
- bookname = ""
- issuedate = ""
- returndate = ""
- Else
- empno = Recordset2("emp_no")
- dept = Recordset2("dept")
- bookname = Recordset2("book_name")
- issuedate = Recordset2("issue_date")
- returndate = Recordset2("return_date")
- End If
- End If
- %>
- <html>
- <head>
- <title>Untitled Document</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- </head>
- <body bgcolor="#FFBFE1">
- <form name="form1" method="post" action="">
- <p align="center"> </p>
- <div align="center">
- <table width="590" border="1">
- <tr>
- <td width="580"><div align="left"><font size="+1"><strong>Search by:</strong>
- </font><strong><a href="seaching.asp"><font color="#000000">Employee
- Number</font></a> <font color="#000000"><a href="Book No.asp">Book
- Number</a> <a href="bookname.asp">Book Name</a> </font></strong></div></td>
- </tr>
- </table>
- </div>
- <div align="center">
- <table width="85%" border="1">
- <tr bgcolor="#CC9966">
- <td width="46%" bgcolor="#FF99CC"><strong>S e a r c h B y</strong></td>
- <td width="54%" bgcolor="#FF99CC"> <select name="search">
- <option value="empno">Employee Number</option>
- <option value="dept">Department</option>
- <option value="bookno">Book Number</option>
- <option value="bookname">Book Name</option>
- <option value="issuedate">Issue Date</option>
- <option value="returndate">Return Date</option>
- <option value="available">Availability</option>
- </select>
- <b>
- <input type="submit" name="Submit" value=" Submit " style="font-size: 1em; color: #FFFF00; text-decoration: blink; font-family: Arial Narrow; font-weight: bold; background-color: #CA0000; background-image: url('Sandeep_pic/50.gif'); " tabindex="3">
- </b> </td>
- </tr>
- </table>
- </div>
- <p align="center"> </p>
- <div align="center">
- <table width="85%" border="1">
- <tr>
- <td width="46%" height="13"><div align="left"><font color="#003300"><strong>Book
- Number </strong></font></div></td>
- <td width="54%"><div align="left"><font color="#003300">
- <select name="book_no" onChange="this.form.submit();">
- <option value="0"></option>
- <%If Recordset1.EOF = False Then
- Recordset1.MoveFirst
- Do While Recordset1.EOF =False
- %>
- <option value="<%=(Recordset1.Fields.Item("book_no").Value)%>" <%If Recordset1("book_no") = bookno Then %> Selected <%End if%> ><%=(Recordset1.Fields.Item("book_no").Value)%></option>
- <%Recordset1.MoveNext
- Loop
- End If%>
- </select>
- </font></div></td>
- </tr>
- </table>
- </div>
- <p> </p>
- <div align="center">
- <table width="86%" border="1">
- <tr>
- <td><strong><font color="#660033">E m p l o y e e N u m b e r</font></strong></td>
- <td> <input name="emp_no" type="text" id="emp_no" value="<%= empno %>">
- </td>
- </tr>
- <tr>
- <td><strong><font color="#660033">D e p a r t m e n t</font></strong></td>
- <td><input name="dept" type="text" id="dept" value="<%= dept %>"></td>
- </tr>
- <tr>
- <td width="46%"><strong><font color="#660033">B o o k N u m b e r </font></strong></td>
- <td width="54%"><input name="book_no" type="text" id="book_no" value="<%= bookno %>"></td>
- </tr>
- <tr>
- <td><strong><font color="#660033">B o o k N a m e</font></strong> </td>
- <td><input name="book_name" type="text" id="book_name" value="<%= bookname %>"></td>
- </tr>
- <tr>
- <td><strong><font color="#660033">I s s u e D a t e</font></strong></td>
- <td><input name="issue_date" type="text" id="issue_date" value="<%= issuedate %>"></td>
- </tr>
- <tr>
- <td><strong><font color="#660033">R e t u r n D a t e</font></strong></td>
- <td><input name="return_date" type="text" id="return_date" value="<%= returndate %>"></td>
- </tr>
- </table>
- </div>
- <p> </p>
- <div align="center">
- <table width="86%" border="1">
- <tr>
- <td height="23" bgcolor="#FF99CC"><div align="center"> </div></td>
- </tr>
- </table>
- </div>
- <p> </p>
- <p> </p>
- <p> </p>
- </form>
- </body>
- </html>
- <%
- Recordset1.Close()
- Set Recordset1 = Nothing
- %>
- .....
" error.
What am I missing here?
Your help is highly appreciated.