Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: format currency error


Message #1 by "Matthew Lohr" <mlohr@t...> on Thu, 13 Apr 2000 09:25:02 -0400
I am getting an error when doing a query against a datbase.  It is saying

there is a type mismatch error.  What is strange is that I am getting 17

records to print out fine and they seem to comback in no particular order

either so I am not sure what is the next record to print.  I have checked

all the entries in this field and they are all correct as far as being in

the currency format



Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FormatCurrency'

/equip/listproductsbyname.asp, line 67





Message #2 by Ellery Familia <ellery@u...> on Thu, 13 Apr 2000 09:46:22 -0400 (EDT)
Send the code.



______________________________________________

Message #3 by "Matthew Lohr" <mlohr@t...> on Thu, 13 Apr 2000 10:04:31 -0400
And yes it looks very similar to the code in the book for beginning asp

because i did modification to fit my datbase and app







<%@ Language=VBScript %>

<% Option Explicit %>

<!--#include virtual="/adovbs.inc"-->

<!--#include file="global.asa"-->



<%

    'Open up a connection to our Access database that stores the team

    'information.  We will use a DSN connection here.

    Dim objConn

    Set objConn = Server.CreateObject("ADODB.Connection")

    objConn.ConnectionString = "DSN=recequip"

    objConn.Open





    'Read in the characters the user entered

    Dim strProductName

    strProductName = Trim(Request("sportcat"))



    'Create our SQL statement variable

    Dim strSQL

    strSQL = "SELECT sportcat, equipment, condition, Price, contact, phone,

email FROM table1 WHERE sportcat LIKE '" & strProductName & "%'" & _

             " ORDER BY Sportcat"



    'Create a recordset object instance, and execute the SQL statement

    Dim objRS

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

    objRS.Open strSQL, objConn

    %>



<table cellspacing="2" cellpadding="2" border="0" >

<tr>

    <td><img src="../images/recbar2.gif" width=262 height=62 border=0

alt=""></td>

    <td><FONT size="+1">RECCOUNCIL Exchange Store</FONT> <BR>

<FONT size="+2"><B>Search Result</B></FONT></td>

</tr>

</table>

<div align=left><a href="../lacrosse/default.asp">Lacrosse Home</a></div>



    <%

    If objRS.EOF then

       'No records were returned for the characters entered by the user

       Response.Write "There is no equipment listings for " & _

                      UCase(strProductName)

    Else

      'There are one or more products that meet the condition entered by

      'the user.  Display these products...

      Response.Write "<B>A Listing of " & _

                     UCase(strProductName) & " equipment :</B><BR>"

                     %>









<table border="1" cellpadding="1" cell="YES"  bordercolor=Black

bgcolor=White>

<tr bgcolor=Aqua>



    <td><b>Equipment</b></td>

    <td><b>Condition</b></td>

    <td><b>Price</b></td>

    <td><b>contact</b></td>

     <td><b>Phone</b></td>

    <td><b>Email</b></td>

</tr>

  <TR>     <%

      Do While Not objRS.EOF

         Response.Write "<td>" & "<p> " &  objRS("equipment") & " <td>

"  & "<p> " & _

	                objRS("condition") & " <td> " & "<p> " &

FormatCurrency(objRS("Price")) &_

	                "<td>" &  "<p> " & _

 objrs("contact") & "<td>" & "<p> " & objRS("phone")%>



<TD> <A HREF='mailto:<%= objRS("Email") %>'><% =objRS("Email")

%></A></TD></tr>

<%



         'Move on to the next customer

         objRS.MoveNext

      Loop

    End If



    'Clean up our ADO objects

    objRS.Close

    Set objRS = Nothing



    objConn.Close

    Set objConn = Nothing

%>



<html>

<body bgcolor=Teal>

</body>

</html>-----Original Message-----

From: Ellery Familia 

Sent: Thursday, April 13, 2000 9:46 AM

To: ASP Databases

Subject: [asp_databases] RE: format currency error





Send the code.



______________________________________________

Message #4 by James Texter <texter@o...> on Fri, 14 Apr 2000 08:01:31 -0500
Matthew,

	If you want to try and eliminate it down to which record is giving the

error, try using the "ORDER BY" clause in your query.  This might especially

helpful if you do something like "SELECT * FROM Table WHERE expression ORDER

BY Currency" where Table is the name of the table, expression is any

expression for the WHERE clause, and Currency is whichever field you are

having troubles with.  Hope this helps.



James



I am getting an error when doing a query against a datbase.  It is saying

there is a type mismatch error.  What is strange is that I am getting 17

records to print out fine and they seem to comback in no particular order

either so I am not sure what is the next record to print.  I have checked

all the entries in this field and they are all correct as far as being in

the currency format



Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FormatCurrency'

/equip/listproductsbyname.asp, line 67



Message #5 by "Matthew Lohr" <mlohr@t...> on Fri, 14 Apr 2000 11:11:04 -0400
I was playing with that this morning actually and the results were strange.

When I would delete a record like the one after the last displayed I would

get a different number of records print out like 5 and then the error.

Every time I deleted a record it gave me some random number of records.

Finally when I deleted a record near the end the error went away.  I can now

safely add records.  I guess that record was corrupt.  I entered a record

with the exact same information without any problems.



Thanks for your help



-----Original Message-----

From: James Texter 

Sent: Friday, April 14, 2000 9:02 AM

To: ASP Databases

Subject: [asp_databases] Re: format currency error





Matthew,

	If you want to try and eliminate it down to which record is giving the

error, try using the "ORDER BY" clause in your query.  This might especially

helpful if you do something like "SELECT * FROM Table WHERE expression ORDER

BY Currency" where Table is the name of the table, expression is any

expression for the WHERE clause, and Currency is whichever field you are

having troubles with.  Hope this helps.



James



I am getting an error when doing a query against a datbase.  It is saying

there is a type mismatch error.  What is strange is that I am getting 17

records to print out fine and they seem to comback in no particular order

either so I am not sure what is the next record to print.  I have checked

all the entries in this field and they are all correct as far as being in

the currency format



Microsoft VBScript runtime error '800a000d'

Type mismatch: 'FormatCurrency'

/equip/listproductsbyname.asp, line 67





---

You are currently subscribed to asp_databases





  Return to Index