What am I doing wrong, I though this would be simple..

G

Graham Mattingley

I am trying to count the records in a database, and make an array from the
answer this is the code


strQuery = "SELECT count(*) FROM resort where island_id= '"&island_drop&"'
;"
Set rsIslandinfo = adoConn.Execute(strQuery)
i = rsIslandinfo("count(*)").Value
** this bit above here works find I have done a response.write to check I
have a number in i

*** I have tryed it with and without the CInt command ***
i=CInt (i)

dim ics (i,2)

I am sure this is possible, what am I doing wrong ??

I just an ERROR 500

Help :)

Graham
 
T

TomB

I said that once and got a good slapping, when doing a count (I was told)
you want to use the asterisk as you may not get an accurate count. I
believe it had to do with NULLS, even if you did a COUNT(ID) where ID is the
PK and obviously wouldn't be Null.

Tom B


Ray at said:
Do you need to count(*) as opposed to just counting one column?

You can use "SELECT COUNT([Something]) AS [TheCount] FROM [resort]..."
and then use
i = rsIslandInfo("TheCount").Value

Or better:

strQuery = "SELECT COUNT([Something]) FROM [resort]..."
Set rsIslandInfo = adoConn.Execute(strQuery)
i = rsIslandInfo.Fields.Item(0).Value

Ray at home



--
Will trade ASP help for SQL Server help


Graham Mattingley said:
I am trying to count the records in a database, and make an array from the
answer this is the code


strQuery = "SELECT count(*) FROM resort where island_id= '"&island_drop&"'
;"
Set rsIslandinfo = adoConn.Execute(strQuery)
i = rsIslandinfo("count(*)").Value
** this bit above here works find I have done a response.write to check I
have a number in i

*** I have tryed it with and without the CInt command ***
i=CInt (i)

dim ics (i,2)

I am sure this is possible, what am I doing wrong ??

I just an ERROR 500

Help :)

Graham
 
R

Ray at

Ah, yes, I think that was just in a recent thread too. I remember reading
that in a thread recently anyway. I'll consider myself slapped. :]

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top