G'day, Whilst trying to solve another problem on my web site, I discovered that this code doesn't do what I would expect. <% Datpath=Server.MapPath("hits.mdb") Set conn = Server.CreateObject("ADODB.Connection") conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& datpath sqlstmt = "select * from hits" Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sqlstmt, conn, adOpenDynamic response.write "<br /> " response.write sqlstmt response.write " <br />" response.write "Record Count = " response.write rs.recordcount response.write "<br />***" set conn = nothing %> It returns this result ... select * from hits Record Count = -1 *** But the hits.mdb contains data so I should not have -1 (Hits is the name of the database and the table.) What have I done wrong.
I don't think recordcount gets populated until you do a move, and even then I seen to recall it's a bity iffy. Try "select count(*) as numrecs from hits" instead regards
Its a very minute mistake but it can land you in trouble like this If you can find the difference then $10 to you. Check out the correction here conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & datpath Nah i should'nt be throwing a wedger here perhaps Happy coding, Surfnearnzone
You mean that space before the & ???? I'm just about to go to bed but I'll try in the morning. Thanks.
exactly. i spent a lot of time figuring this out and was nuts after i knew it i mean when i had started in asp and access