Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Be nice

Reply
Thread Tools

Be nice

 
 
Bob Barrows
Guest
Posts: n/a
 
      11-08-2003
OK, you've intrigued me. I am going to try to reproduce this on my machine.
It's an Access database, right? Can you give me an example of the data that
produces this error... wait a minute. I bet I know what the issue is. Let me
go and test it. I'll be right back ...

No, that's not it. I thought that the failure to explicitly specify the
field's value property was causing the problem, i.e.:

Response.Write rs(0) + "<BR>"
vs
Response.Write rsFields(0).value + "<BR>"

but that turned out not to be the problem - both of these statements worked
well for me. So the only alternative is that in your table, rs(0) is not a
Text column. In fact, using a numeric column was the only way I could
reproduce your error:

rs.Open "SELECT NumberColumn FROM tblblogs",cn, _
,,adCmdText
Response.Write rs(0) + "<BR>"

I made a mistake in my first reply in this thread. If you go back and
re-read the documentation
(http://msdn.microsoft.com/library/en...ncatenation.as
p), you will see that when a number and a string are the addends of the +
operator, addition is attempted, not concatenation. So,

Response.Write 1 + "<BR>"
will cause a type mismatch, since "<BR>" cannot be coerced to a number.

Response.Write 1 + "1"
will result in 2

Response.Write Cstr(1) + "1"
will result in "11"

To reiterate, when using the + operator, concatenation only occurs when both
addends are strings.

Using & will cause both addends to be converted to strings, no matter what
datatype they are initially, so concatenation will always occur.

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      11-08-2003
Bob Barrows wrote:
> Response.Write rsFields(0).value + "<BR>"
>

should be
Response.Write rs.Fields(0).value + "<BR>"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
nice featurlette deerpark aka ff 1.6a Splibbilla Firefox 1 09-17-2005 06:31 AM
Very nice MMORPG (FREE) Silverstrand Gaming 7 08-14-2005 03:41 AM
Bookmarks not playing nice MEow Firefox 2 12-21-2004 04:48 PM
Nice PHP script Charles Firefox 6 06-23-2004 09:44 PM
Re: Nice PHP script Matt Firefox 1 06-23-2004 03:37 PM



Advertisments