Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Type mismatch


Message #1 by "Oliver Dempsey" <odempsey@b...> on Sat, 9 Dec 2000 21:24:22 -0000
This is a multi-part message in MIME format.



------=_NextPart_000_0050_01C06226.65AD2820

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



 

value=3D"<%=3D(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Field

s.Item("Town").Value)%>"><%=3D(rsCount.Fields.Item("CountOfCounty").Value

)%></option>

    <%







why is this giving me a runtime error '800a000d' Type mismatch?





Regards

Oliver






Message #2 by "Scott Munro" <samunro@y...> on Sun, 10 Dec 2000 12:09:04 +0800
Not sure of the context but try replacing the + sign with &. Because the

value of the first field is a number, this operation might be interpreted as

numeric. Therefore it is looking for a number from Town but receives a

string.



Cheers,



Scott.



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

From: Oliver Dempsey [mailto:odempsey@b...]

Sent: Sunday, 10 December 2000 5:24 AM

To: ASP Databases

Subject: [asp_databases] Type mismatch





value="<%=(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Fields.Item(

"Town").Value)%>"><%=(rsCount.Fields.Item("CountOfCounty").Value)%></option>

    <%







why is this giving me a runtime error '800a000d' Type mismatch?





Regards

Oliver

Message #3 by "Dallas Martin" <dmartin@z...> on Sat, 9 Dec 2000 18:39:00 -0500
replace the "+" with "&".



The VBScript interpreter thinks you are trying to add an integer to a 

string.



<option value=3D"<%=3D(rsCount.Fields.Item("CountOfCounty").Value)  &  

(rsCount.Fields.Item("Town").Value)%>">

<%=3DrsCount.Fields.Item("CountOfCounty").Value)%></option>





hth,

Dallas Martin



    <%

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

  From: Oliver Dempsey

  To: ASP Databases

  Sent: Saturday, December 09, 2000 4:24 PM

  Subject: [asp_databases] Type mismatch





   

value=3D"<%=3D(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Field

s.Item("Town").Value)%>"><%=3D(rsCount.Fields.Item("CountOfCounty").Value

)%></option>

      <%

  

  

  

  why is this giving me a runtime error '800a000d' Type mismatch?





  Regards

  Oliver

Message #4 by "Reginald Dawson" <rdawson@w...> on Sun, 10 Dec 2000 00:58:01 -0000
If you just want the count, why not use a SQL command instead of an ADO

recordset?  This seems to be faster on your SQL DB.  For instance :



set Objrs = Server.CreateObject("ADODB.Recordset")

"SELECT COUNT(ID) AS IDCOUNT "



In the example above, 'ID' is the name of your key id field (which is

faster to count for SQL) and 'IDCOUNT' is a variable you can designate and

have SQL store it.



To access this count in ADO, use Objrs("IDCOUNT")



This will return a value for your count.  Now you can use this count as

you want.  Like : if Objrs("IDCOUNT") > 0 Then do something... or, in your

case <%=Objrs("IDCOUNT")%>.  Using the SQL COUNT function is better for just counts unless you

have already created a recordset; then you would just use

Objrs.Recordcount as a numeric variable.



In short, let SQL store the count and just access that variable; it is

faster.



Good Luck...

Message #5 by "Eric Van Camp" <eric.vancamp@c...> on Sun, 10 Dec 2000 11:34:36 -0000

because you are mixing strings and numbers, i suppose countofcounty is a

number and the rest is text, i don't know exactly what you are trying to do?

can you elaborate?

eric

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

    From: Oliver Dempsey [mailto:odempsey@b...]

    Sent: Saturday, December 09, 2000 9:24 PM

    To: ASP Databases

    Subject: [asp_databases] Type mismatch







value="<%=(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Fields.Item(

"Town").Value)%>"><%=(rsCount.Fields.Item("CountOfCounty").Value)%></option>

        <%







    why is this giving me a runtime error '800a000d' Type mismatch?





    Regards

    Oliver

Message #6 by "Ken Schaefer" <ken@a...> on Sun, 10 Dec 2000 22:27:55 +1100
Cast your Recordset fields as integers or doubles, then add them.

Check using IsNumeric field though...



If isNumeric(rsCount.Fields.Item("CountofCounty").Value and

isNumeric(rsCount.Fields.Item("Town").Value) then



    value=""" & CDbl(rsCount.Fields.Item("CountofCounty").Value) +

CDbl(rsCount.Fields.Item("Town").Value) & """



End if





HTH



Cheers

Ken



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

From: "Oliver Dempsey" <odempsey@b...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, December 10, 2000 8:24 AM

Subject: [asp_databases] Type mismatch





value="<%=(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Fields.Item(

"Town").Value)%>"><%=(rsCount.Fields.Item("CountOfCounty").Value)%></option>

    <%







why is this giving me a runtime error '800a000d' Type mismatch?





Regards

Oliver





Message #7 by "Oliver Dempsey" <odempsey@b...> on Sun, 10 Dec 2000 13:38:58 -0000
When I replace the + with an &, I don't get an error but I only get the

first field coming up in the List Menu instead of two.





Oliver









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

From: Scott Munro <samunro@y...>

To: ASP Databases <asp_databases@p...>

Sent: Sunday, December 10, 2000 4:09 AM

Subject: [asp_databases] RE: Type mismatch







Message #8 by "Oliver Dempsey" <odempsey@b...> on Sun, 10 Dec 2000 13:46:31 -0000
What is the 3D and the &= for, they're giving syntax errors





Oliver





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

From: Dallas Martin <dmartin@z...>

To: ASP Databases <asp_databases@p...>

Sent: Saturday, December 09, 2000 11:39 PM

Subject: [asp_databases] Re: Type mismatch







Message #9 by "Oliver Dempsey" <odempsey@b...> on Sun, 10 Dec 2000 13:51:46 -0000
Thanks Reginald,

that looks like a good idea but is a little too advanced for me right now,

what book would I find that stuff in?





Regards

Oliver







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

From: Reginald Dawson <rdawson@w...>

To: ASP Databases <asp_databases@p...>

Sent: Sunday, December 10, 2000 12:58 AM

Subject: [asp_databases] Re: Type mismatch





> If you just want the count, why not use a SQL command instead of an ADO

> recordset?  This seems to be faster on your SQL DB.  For instance :

>

> set Objrs = Server.CreateObject("ADODB.Recordset")

> "SELECT COUNT(ID) AS IDCOUNT "

>

> In the example above, 'ID' is the name of your key id field (which is

> faster to count for SQL) and 'IDCOUNT' is a variable you can designate and

> have SQL store it.

>

> To access this count in ADO, use Objrs("IDCOUNT")

>

> This will return a value for your count.  Now you can use this count as

> you want.  Like : if Objrs("IDCOUNT") > 0 Then do something... or, in your

> case <%=Objrs("IDCOUNT")%>.  Using the SQL COUNT function is better for

just counts unless you

> have already created a recordset; then you would just use

> Objrs.Recordcount as a numeric variable.

>

> In short, let SQL store the count and just access that variable; it is

> faster.

>

> Good Luck...

>





Message #10 by "Oliver Dempsey" <odempsey@b...> on Sun, 10 Dec 2000 13:55:10 -0000
I actually have them backwards in that example but I am trying to put the

number of properties in each town after it in the list menu.

e.g.

TownOne (2)

TownTwo (0)

TownThree (1)





Oliver







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

From: Eric Van Camp <eric.vancamp@c...>

To: ASP Databases <asp_databases@p...>

Sent: Sunday, December 10, 2000 11:34 AM

Subject: [asp_databases] RE: Type mismatch







Message #11 by "Oliver Dempsey" <odempsey@b...> on Sun, 10 Dec 2000 14:03:21 -0000
At present one field is a string and the other is an integer.

What does the double do to it?





Oliver







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

From: Ken Schaefer <ken@a...>

To: ASP Databases <asp_databases@p...>

Sent: Sunday, December 10, 2000 11:27 AM

Subject: [asp_databases] Re: Type mismatch





> Cast your Recordset fields as integers or doubles, then add them.

> Check using IsNumeric field though...

>

> If isNumeric(rsCount.Fields.Item("CountofCounty").Value and

> isNumeric(rsCount.Fields.Item("Town").Value) then

>

>     value=""" & CDbl(rsCount.Fields.Item("CountofCounty").Value) +

> CDbl(rsCount.Fields.Item("Town").Value) & """

>

> End if

>

>

> HTH

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "Oliver Dempsey" <odempsey@b...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Sunday, December 10, 2000 8:24 AM

> Subject: [asp_databases] Type mismatch

>

>

>

value="<%=(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Fields.Item(

>

"Town").Value)%>"><%=(rsCount.Fields.Item("CountOfCounty").Value)%></option>

>     <%

>

>

>

> why is this giving me a runtime error '800a000d' Type mismatch?

>

>

> Regards

> Oliver

>

>

Message #12 by "Oliver Dempsey" <odempsey@b...> on Sun, 10 Dec 2000 15:03:44 -0000
This is a multi-part message in MIME format.



------=_NextPart_000_0041_01C062BA.63D4BF60

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Got it sorted.  Originally my problem was that the two fields would not 

display side by side in the list menu.  In the midst of juggling the 

code around, I put in the '+' sign instead of the '&'.  

I failed to notice that I had the two fields on the wrong side.

I should have had it like this:-

 

value=3D"<%=3D(rsCount.Fields.Item("Town").Value)%>"><%=3D(rsCount.Fields

.Item("Town").Value) & " (" & 

(rsCount.Fields.Item("CountOfCounty").Value) &")"%></option>

    <%





Thanks for all your help. 

Sorry for posting so many messages in a row, I was trying to respond to 

each message individually but it doesn't look like that when the 

messages end up in a row one after another.





Oliver Dempsey









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

  From: Oliver Dempsey

  To: ASP Databases

  Sent: Saturday, December 09, 2000 9:24 PM

  Subject: [asp_databases] Type mismatch





   

value=3D"<%=3D(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Field

s.Item("Town").Value)%>"><%=3D(rsCount.Fields.Item("CountOfCounty").Value

)%></option>

      <%

  

  

  

  why is this giving me a runtime error '800a000d' Type mismatch?





  Regards

  Oliver

  ---

  FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

  INSIGHTS IN YOUR INBOX!

  Get the latest and best C++, Visual C++, Java, Visual Basic, and XML 

tips, tools, and

  developments from the experts. Sign up for one or more of EarthWeb?s

  FREE IT newsletters at http://www.earthweb.com today!



odempsey@b...


$subst('Email.Unsub')








Message #13 by "Reginald Dawson" <rdawson@w...> on Sun, 10 Dec 2000 20:07:46 -0000
I found this info in my "Wrox : Beginning ASP" book.  Obviously since I am

at this site, I am a bit bias but I do recommend Wrox books for any of

your programming instructionals; they are quite thorough.



Later...

Reginald Dawson

Message #14 by "Michael Goldman" <mg188@h...> on Sun, 10 Dec 2000 12:16:59 -0800
Maybe using the FormatNumber function on the string would solve the problem.



here's how the MS VBscript doc describes it:

FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit

[,UseParensForNegativeNumbers [,GroupDigits]]]])



The stuff in brackets [] are options.  So I think you can just use:

FormatNumber(yourstring) if yourstring is a number in text format.



Happy Trails,



Mike

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

From: "Oliver Dempsey" <odempsey@b...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, December 10, 2000 6:03 AM

Subject: [asp_databases] Re: Type mismatch





> At present one field is a string and the other is an integer.

> What does the double do to it?

>

>

> Oliver

>

>

>

> ----- Original Message -----

> From: Ken Schaefer <ken@a...>

> To: ASP Databases <asp_databases@p...>

> Sent: Sunday, December 10, 2000 11:27 AM

> Subject: [asp_databases] Re: Type mismatch

>

>

> > Cast your Recordset fields as integers or doubles, then add them.

> > Check using IsNumeric field though...

> >

> > If isNumeric(rsCount.Fields.Item("CountofCounty").Value and

> > isNumeric(rsCount.Fields.Item("Town").Value) then

> >

> >     value=""" & CDbl(rsCount.Fields.Item("CountofCounty").Value) +

> > CDbl(rsCount.Fields.Item("Town").Value) & """

> >

> > End if

> >

> >

> > HTH

> >

> > Cheers

> > Ken

> >

> > ----- Original Message -----

> > From: "Oliver Dempsey" <odempsey@b...>

> > To: "ASP Databases" <asp_databases@p...>

> > Sent: Sunday, December 10, 2000 8:24 AM

> > Subject: [asp_databases] Type mismatch

> >

> >

> >

>

value="<%=(rsCount.Fields.Item("CountOfCounty").Value)+(rsCount.Fields.Item(

> >

>

"Town").Value)%>"><%=(rsCount.Fields.Item("CountOfCounty").Value)%></option>

> >     <%

> >

> >

> >

> > why is this giving me a runtime error '800a000d' Type mismatch?

> >

> >

> > Regards

> > Oliver

> >

> >

>



Message #15 by "Ken Schaefer" <ken@a...> on Mon, 11 Dec 2000 11:34:40 +1100
I saw you were using the + operator, not the & operator, so I assumed that

you have two numeric values, however ASP was treating one as a text string,

and thus giving you grief with the Type Mismatch error.



When you ask "What does the double do to it?" are you asking what a double

is? It's a type of numeric format, like integer is a type of numeric format.

You may be familiar with CInt(), which casts a variant as sub-type integer,

but in the process you lose all the info after the decimal point. To get

around this, you want to use numeric sub-types that retain the information

after the decimal point, eg Singles and Doubles.



Cheers

Ken



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

From: "Oliver Dempsey" <odempsey@b...>

To: "ASP Databases" <asp_databases@p...>

Sent: Monday, December 11, 2000 1:03 AM

Subject: [asp_databases] Re: Type mismatch





> At present one field is a string and the other is an integer.

> What does the double do to it?

>

>

> Oliver

>





Message #16 by "Oliver Dempsey" <odempsey@b...> on Mon, 11 Dec 2000 11:44:58 -0000
Hi Reginald,

I agree, I have that book but I  didn't realise the Count command thing was

in it.





Thanks

Oliver







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

From: Reginald Dawson <rdawson@w...>

To: ASP Databases <asp_databases@p...>

Sent: Sunday, December 10, 2000 8:07 PM

Subject: [asp_databases] Re: Type mismatch





> I found this info in my "Wrox : Beginning ASP" book.  Obviously since I am

> at this site, I am a bit bias but I do recommend Wrox books for any of

> your programming instructionals; they are quite thorough.

>

> Later...

> Reginald Dawson

>



Message #17 by "Scott Munro" <samunro@y...> on Mon, 11 Dec 2000 18:19:09 +0800
I think you might need to elaborate a little on what you are trying to do.



Some things you could try are replacing the recordset references with

examples of strings you want in your option list to check that you have the

syntax for the option list right.



You could also 'Response.Write' the recordset references to check that they

are returning the strings that you are after.



Cheers,



Scott.



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

From: Oliver Dempsey [mailto:odempsey@b...]

Sent: Sunday, 10 December 2000 9:39 PM

To: ASP Databases

Subject: [asp_databases] RE: Type mismatch



When I replace the + with an &, I don't get an error but I only get the

first field coming up in the List Menu instead of two.





Oliver




  Return to Index