Data type Mismatch

Results 1 to 3 of 3

Thread: Data type Mismatch

  1. #1
    Matthew Kirwan Guest

    Default Data type Mismatch

    Hi,<BR><BR>I have an ASP page that displays a number of possible subjects(extracted from a database into a form) that users can obtain further information on. Users can select a subject via a radio button. The code for this line is:<BR><BR>&#060;input type="radio" name="choice" value="&#060;%=objRS("ID")%&#062;"&#062;&#060;/td&#062;<BR><BR>The ID value is passed to another script which displays the information about the subject.<BR><BR>I can&#039;t get this script to work. What I get is the error -"Data Type mismatch in criteria expression". This refers to line 36 of my code below. However I have used CLng to typecast the value passed to a Long. The diagnostic print staements in my code below give the following output before the error occurs.<BR><BR>IStringList<BR>97<BR>Long<BR>SELECT * FROM Offences WHERE ID= &#039;97&#039;<BR><BR>I have no idea what IStringList is. Otherwise everything seems fine.<BR><BR>Could someone please help.<BR><BR>Regards,<BR><BR>Matthew<BR>__________ ______________________________<BR><BR>Relevant section of code:<BR><BR>26 &#060;% <BR>27 Dim objRS, strSQL, lChoice<BR>28 Response.Write TypeName(Request.Form("choice")) & <BR> "<BR>" <BR>29 lChoice = CLng(Request.Form("choice"))<BR>30 Response.Write lChoice & "<BR>" <BR>31 Response.Write TypeName(lChoice) & "<BR>"<BR>32 strSQL = "SELECT * FROM Offences "_<BR>33 & "WHERE ID=&#039;" & lChoice & "&#039; "<BR>34 Response.Write strSQL<BR>35 Set objRS = Server.CreateObject("ADODB.Recordset")<BR>36 ObjRS.Open strSQL, objConn, adOpenKeySet, <BR> adLockOptimistic<BR>37<BR>38 ObjRS.Close<BR>39 Set objRS = Nothing<BR>40 ObjConn.Close<BR>41 Set objConn = Nothing<BR>42 %&#062;<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default ASPFAQs (link at top right of this page)<BR><BR>You are putting &#039;...&#039; around a numeric value. <BR><BR>

  3. #3
    Matthew Kirwan Guest

    Default RE: ASPFAQs (link at top right of this page)

    Thanks Bill. I would never have seen it!<BR><BR>Kind Regards,<BR><BR>Matthew

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts