By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,795 Members | 1,666 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,795 IT Pros & Developers. It's quick & easy.

Microsoft VBScript runtime (0x800A000D)

P: 2
Hello:

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
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <!--#include file="Connections/Dcon.asp" -->
  3. <%
  4. Dim empno, dept, bookno, bookname, issuedate, returndate
  5.  
  6. Dim Recordset1, Recordset2
  7. Dim Recordset1_numRows
  8. Set Conn = Server.CreateObject("ADODB.Connection")
  9. 'Conn.open "DSN=MQIS"
  10. Conn.open "Driver={SQL Server};Server=KBLPC027;Database=libraryinfo;Trusted_Connection=Yes;"
  11. 'Conn.open "Initial Catalog=lib;Data Source=KBLPC107;Integrated Security=SSPI"
  12. 'Conn.open "Driver={SQL Server};Server=KBLPC107;Database=lib;Uid=sa;Pwd=;"
  13. %> 
  14. <%
  15. Set Recordset1 = Server.CreateObject("ADODB.Recordset")
  16. Recordset1.ActiveConnection = MM_Dcon_STRING
  17. Recordset1.Source = "SELECT *  FROM dbo.transact"
  18. Recordset1.CursorType = 0
  19. Recordset1.CursorLocation = 2
  20. Recordset1.LockType = 1
  21. Recordset1.Open()
  22.  
  23. Recordset1_numRows = 0
  24.  
  25. '----- Populate If Posted any Data
  26. bookno = Request.Form("book_no")
  27. 'search = Request.Form("search")
  28.  
  29. If bookno = "" Then
  30.     bookno = 0
  31. Else
  32.     bookno = chr(bookno)
  33. End If
  34.  
  35. If bookno = 0 Then
  36.     empno = ""
  37.     dept = ""
  38.     bookname = ""
  39.     issuedate = ""
  40.     returndate = ""
  41. Else
  42.     Set Recordset2 = Server.CreateObject("ADODB.Recordset")
  43.     Set Recordset2 = conn.Execute("SELECT * FROM transact WHERE book_no = " & bookno)
  44.     If Recordset2.BOF = True Then
  45.         empno = ""
  46.         dept = ""
  47.         bookname = ""
  48.         issuedate = ""
  49.         returndate = ""
  50.     Else
  51.         empno = Recordset2("emp_no")
  52.         dept = Recordset2("dept")
  53.         bookname = Recordset2("book_name")
  54.         issuedate = Recordset2("issue_date")
  55.         returndate = Recordset2("return_date")
  56.     End If
  57. End If
  58. %>
  59. <html>
  60. <head>
  61. <title>Untitled Document</title>
  62. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  63. </head>
  64.  
  65. <body bgcolor="#FFBFE1">
  66. <form name="form1" method="post" action="">
  67.   <p align="center">&nbsp;</p>
  68.   <div align="center">
  69.     <table width="590" border="1">
  70.       <tr> 
  71.         <td width="580"><div align="left"><font size="+1"><strong>Search by:</strong> 
  72.             </font><strong><a href="seaching.asp"><font color="#000000">Employee 
  73.             Number</font></a> <font color="#000000"><a href="Book No.asp">Book 
  74.             Number</a> <a href="bookname.asp">Book Name</a> </font></strong></div></td>
  75.       </tr>
  76.     </table>
  77.   </div>
  78.   <div align="center">
  79.     <table width="85%" border="1">
  80.       <tr bgcolor="#CC9966"> 
  81.         <td width="46%" bgcolor="#FF99CC"><strong>S e a r c h B y</strong></td>
  82.         <td width="54%" bgcolor="#FF99CC"> <select name="search">
  83.             <option value="empno">Employee Number</option>
  84.             <option value="dept">Department</option>
  85.             <option value="bookno">Book Number</option>
  86.             <option value="bookname">Book Name</option>
  87.             <option value="issuedate">Issue Date</option>
  88.             <option value="returndate">Return Date</option>
  89.             <option value="available">Availability</option>
  90.           </select>
  91.           <b> 
  92.           <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">
  93.           </b> </td>
  94.       </tr>
  95.     </table>
  96.   </div>
  97.   <p align="center">&nbsp;</p>
  98.   <div align="center"> 
  99.     <table width="85%" border="1">
  100.       <tr> 
  101.         <td width="46%" height="13"><div align="left"><font color="#003300"><strong>Book 
  102.             Number </strong></font></div></td>
  103.         <td width="54%"><div align="left"><font color="#003300"> 
  104.             <select name="book_no" onChange="this.form.submit();">
  105.               <option value="0"></option>
  106.               <%If Recordset1.EOF = False Then 
  107.       Recordset1.MoveFirst
  108.       Do While Recordset1.EOF =False
  109.       %>
  110.               <option value="<%=(Recordset1.Fields.Item("book_no").Value)%>" <%If Recordset1("book_no") = bookno Then %> Selected <%End if%>  ><%=(Recordset1.Fields.Item("book_no").Value)%></option>
  111.               <%Recordset1.MoveNext
  112.       Loop
  113.       End If%>
  114.             </select>
  115.             </font></div></td>
  116.       </tr>
  117.     </table>
  118.   </div>
  119.   <p>&nbsp;</p>
  120.   <div align="center"> 
  121.     <table width="86%" border="1">
  122.       <tr> 
  123.         <td><strong><font color="#660033">E m p l o y e e N u m b e r</font></strong></td>
  124.         <td> <input name="emp_no" type="text" id="emp_no" value="<%= empno %>"> 
  125.         </td>
  126.       </tr>
  127.       <tr> 
  128.         <td><strong><font color="#660033">D e p a r t m e n t</font></strong></td>
  129.         <td><input name="dept" type="text" id="dept" value="<%= dept %>"></td>
  130.       </tr>
  131.       <tr> 
  132.         <td width="46%"><strong><font color="#660033">B o o k N u m b e r </font></strong></td>
  133.         <td width="54%"><input name="book_no" type="text" id="book_no" value="<%= bookno %>"></td>
  134.       </tr>
  135.       <tr> 
  136.         <td><strong><font color="#660033">B o o k N a m e</font></strong> </td>
  137.         <td><input name="book_name" type="text" id="book_name" value="<%= bookname %>"></td>
  138.       </tr>
  139.       <tr> 
  140.         <td><strong><font color="#660033">I s s u e D a t e</font></strong></td>
  141.         <td><input name="issue_date" type="text" id="issue_date" value="<%= issuedate %>"></td>
  142.       </tr>
  143.       <tr> 
  144.         <td><strong><font color="#660033">R e t u r n D a t e</font></strong></td>
  145.         <td><input name="return_date" type="text" id="return_date" value="<%= returndate %>"></td>
  146.       </tr>
  147.     </table>
  148.   </div>
  149.   <p>&nbsp;</p>
  150.   <div align="center"> 
  151.     <table width="86%" border="1">
  152.       <tr> 
  153.         <td height="23" bgcolor="#FF99CC"><div align="center"> </div></td>
  154.       </tr>
  155.     </table>
  156.   </div>
  157.   <p>&nbsp;</p>
  158.   <p>&nbsp;</p>
  159.   <p>&nbsp;</p>
  160. </form>
  161. </body>
  162. </html>
  163. <%
  164. Recordset1.Close()
  165. Set Recordset1 = Nothing
  166. %>
  167. .....
  168.  
I got mismatch "'[string: "d-03-07, 0"]'
" error.

What am I missing here?

Your help is highly appreciated.
Apr 26 '07 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
Expand|Select|Wrap|Line Numbers
  1. '----- Populate If Posted any Data
  2. 'bookno = Request.Form("book_no")
  3. 'search = Request.Form("search")
  4.  
  5. If request.form("book_no") = "" Then
  6.     bookno = chr(0)
  7. Else
  8.     bookno = chr(request.form("book_no"))
  9. End If
  10.  
The problem was coming up because you tried to change the variable type. Even though you don't choose a variable type when you declare a variable, you can't change the type of variable after it is assigned a value.

Let me know if this helps.

Jared
Apr 26 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.