For Programmers: Free Programming Magazines  


Home > Archive > ASP > February 2006 > help type mismatch









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author help type mismatch
isaac2004

2006-02-17, 3:55 am

hello i am getting a type mismatch for a page i am trying to write. any
help would be great

source code

<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include file="DatabaseConnect.asp"-->
<!--#include virtual="06winter/levini/database/adovbs.inc"-->
<html>
<head><title>Gbooks.com</title></head>
<table

<!-- Header SSI starts here-->
<!--#include file="header.html"-->
<!-- Header SSI ends here-->
<!-- Menu SSI starts here-->
<!--#include file="menu.asp"-->
<!-- Menu SSI ends here-->

<% Dim strSQL, objRS, intBookID, strItemType

randomize
intBookID = int(11 * rnd(1)) +1

strSQL = "SELECT tblBookDescription.ISBN, tblBookDescription.BookID,
tblBookDescription.strTitle, tblBookDescription.strDescription " & _
"FROM tblBookDescription " & _
"WHERE (((tblBookDescription.BookID)=6)) OR
(((tblBookDescription.BookID)=7)) OR (((tblBookDescription.BookID)=8));
"


response.write("strSQL = " & strSQL)

---------------------------------------------error type mismatch
strISBN = objRS("ISBN")
--------------------------------------------------------------------
strTitle = objRS("strTitle")
strDescription = objRS("strDescription")

Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.open strSQL, objConn



objRS.close
Set objRS = nothing
objConn.close
Set objRS = nothing

%>




</td>
<td valign="top"><font face="Comic Sans MS"
color="#CC0000">Today's Featured Books</font>
<table border="0">
<tr>
<td>
<p><font face="Comic Sans MS" color="#006699"> <%
=strTitle%> </font><br>

<a href="ProductPage.asp?isbn=<% =strISBN%>">
<img height="97" width="69" hspace="7"
vspace="3" src="/sandvig/bookstore/images/<%
=strISBN%>.01.20TLZZZZ.gif" align="left" border="0">
</a>

<% =strDescription %>
<a href="ProductPage.asp?isbn=<% =strISBN%>">
more...</a>
</td>
</tr>
<tr>
<td>
<p><font face="Comic Sans MS" color="#006699"> <%
=strTitle%> </font><br>

<a href="ProductPage.asp?isbn=<% =strISBN%>">
<img height="97" width="69" hspace="7"
vspace="3" src="/sandvig/bookstore/images/<%
=strISBN%>.01.20TLZZZZ.gif" align="left" border="0">
</a>

<% =strDescription %>
<a href="ProductPage.asp?isbn=<% =strISBN%>">
more...</a>
</td>
</tr>
<tr>
<td>
<p><font face="Comic Sans MS" color="#006699"> <%
=strTitle%> </font><br>

<a href="ProductPage.asp?isbn=<% =strISBN%>">
<img height="97" width="69" hspace="7"
vspace="3" src="/sandvig/bookstore/images/<%
=strISBN%>.01.20TLZZZZ.gif" align="left" border="0">
</a>

<% =strDescription %>
<a href="ProductPage.asp?isbn=<% =strISBN%>">
more...</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
<br><br>
</td>
</tr>
</table>
</center>
</div>

<!--#include file="footer.html"-->
<!--Menu SSI ends here-->


</body></html>


is this error from trying to put a record set into a string. help me
please thank you

Steven Burn

2006-02-17, 3:55 am

Have you tried........

Response.Write "<b>DEBUG: </b> " & objRS("ISBN")

Will allow you to see whatever is in the field .....?

Or even;

Response.Write "<b>DEBUG: </b> " & objRS("ISBN").Value

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"isaac2004" <isaac_2004@yahoo.com> wrote in message
news:1140154931.837218.16690@g43g2000cwa.googlegroups.com...
> hello i am getting a type mismatch for a page i am trying to write. any
> help would be great
>
> source code
>
> <%@ Language=VBScript %>
> <% Option Explicit %>
> <!--#include file="DatabaseConnect.asp"-->
> <!--#include virtual="06winter/levini/database/adovbs.inc"-->
> <html>
> <head><title>Gbooks.com</title></head>
> <table
>
> <!-- Header SSI starts here-->
> <!--#include file="header.html"-->
> <!-- Header SSI ends here-->
> <!-- Menu SSI starts here-->
> <!--#include file="menu.asp"-->
> <!-- Menu SSI ends here-->
>
> <% Dim strSQL, objRS, intBookID, strItemType
>
> randomize
> intBookID = int(11 * rnd(1)) +1
>
> strSQL = "SELECT tblBookDescription.ISBN, tblBookDescription.BookID,
> tblBookDescription.strTitle, tblBookDescription.strDescription " & _
> "FROM tblBookDescription " & _
> "WHERE (((tblBookDescription.BookID)=6)) OR
> (((tblBookDescription.BookID)=7)) OR (((tblBookDescription.BookID)=8));
> "
>
>
> response.write("strSQL = " & strSQL)
>
> ---------------------------------------------error type mismatch
> strISBN = objRS("ISBN")
> --------------------------------------------------------------------
> strTitle = objRS("strTitle")
> strDescription = objRS("strDescription")
>
> Set objRS = Server.CreateObject("ADODB.Recordset")
>
> objRS.open strSQL, objConn
>
>
>
> objRS.close
> Set objRS = nothing
> objConn.close
> Set objRS = nothing
>
> %>
>
>
>
>
> </td>
> <td valign="top"><font face="Comic Sans MS"
> color="#CC0000">Today's Featured Books</font>
> <table border="0">
> <tr>
> <td>
> <p><font face="Comic Sans MS" color="#006699"> <%
> =strTitle%> </font><br>
>
> <a href="ProductPage.asp?isbn=<% =strISBN%>">
> <img height="97" width="69" hspace="7"
> vspace="3" src="/sandvig/bookstore/images/<%
> =strISBN%>.01.20TLZZZZ.gif" align="left" border="0">
> </a>
>
> <% =strDescription %>
> <a href="ProductPage.asp?isbn=<% =strISBN%>">
> more...</a>
> </td>
> </tr>
> <tr>
> <td>
> <p><font face="Comic Sans MS" color="#006699"> <%
> =strTitle%> </font><br>
>
> <a href="ProductPage.asp?isbn=<% =strISBN%>">
> <img height="97" width="69" hspace="7"
> vspace="3" src="/sandvig/bookstore/images/<%
> =strISBN%>.01.20TLZZZZ.gif" align="left" border="0">
> </a>
>
> <% =strDescription %>
> <a href="ProductPage.asp?isbn=<% =strISBN%>">
> more...</a>
> </td>
> </tr>
> <tr>
> <td>
> <p><font face="Comic Sans MS" color="#006699"> <%
> =strTitle%> </font><br>
>
> <a href="ProductPage.asp?isbn=<% =strISBN%>">
> <img height="97" width="69" hspace="7"
> vspace="3" src="/sandvig/bookstore/images/<%
> =strISBN%>.01.20TLZZZZ.gif" align="left" border="0">
> </a>
>
> <% =strDescription %>
> <a href="ProductPage.asp?isbn=<% =strISBN%>">
> more...</a>
> </td>
> </tr>
> </table>
> </td>
> </tr>
> </table>
> </center>
> </div>
> <br><br>
> </td>
> </tr>
> </table>
> </center>
> </div>
>
> <!--#include file="footer.html"-->
> <!--Menu SSI ends here-->
>
>
> </body></html>
>
>
> is this error from trying to put a record set into a string. help me
> please thank you
>



Lee Carnell

2006-02-17, 3:55 am

<snipped>
> strSQL = "SELECT tblBookDescription.ISBN, tblBookDescription.BookID,
> tblBookDescription.strTitle, tblBookDescription.strDescription " & _
> "FROM tblBookDescription " & _
> "WHERE (((tblBookDescription.BookID)=6)) OR
> (((tblBookDescription.BookID)=7)) OR (((tblBookDescription.BookID)=8));
> "
>
>
> response.write("strSQL = " & strSQL)
>
> ---------------------------------------------error type mismatch
> strISBN = objRS("ISBN")
> --------------------------------------------------------------------
> strTitle = objRS("strTitle")
> strDescription = objRS("strDescription")
>
> Set objRS = Server.CreateObject("ADODB.Recordset")
>
> objRS.open strSQL, objConn
>
>
>
> objRS.close
> Set objRS = nothing
> objConn.close
> Set objRS = nothing
>
> %>


You're trying to fill the variables before you've opened the recordset - try
this...

[SQL Satement here]

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.open strSQL, objConn
strISBN = objRS("ISBN")
strTitle = objRS("strTitle")
strDescription = objRS("strDescription")
objRS.close
Set objRS = nothing
objConn.close
Set objRS = nothing


Cheers,

Lee



Steven Burn

2006-02-17, 3:55 am

"Lee Carnell" <leexcarnell@gmailxcom> wrote in message
news:43f58f35$0$1173$5a6aecb4@news.aaisp.net.uk...
</snip>
>
> You're trying to fill the variables before you've opened the recordset -

try
> this...


LMFAO!.... I should've caught that one (serves me right for not sleeping I
suppose <g> )

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


Lee Carnell

2006-02-17, 7:55 am

>> You're trying to fill the variables before you've opened the recordset -
> try
>
> LMFAO!.... I should've caught that one (serves me right for not sleeping I
> suppose <g> )
>
> --


I was surprised that you missed it :)


Steven Burn

2006-02-17, 7:55 am

"Lee Carnell" <leexcarnell@gmailxcom> wrote in message
news:43f5b6ca$0$1169$5a6aecb4@news.aaisp.net.uk...
recordset -[color=darkred]
I[color=darkred]
>
> I was surprised that you missed it :)


I was more disgusted than surprised ... lol

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!


isaac2004

2006-02-17, 6:55 pm

>I was more disgusted than surprised ... lol


wow i feel dumb thanks for the help

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com