473,394 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Recordset count

347 100+
I am trying to get a total recordset count in the asp script at the top of my page in the header i am getting -1 for the result can anyone help

this is the code i am using
Expand|Select|Wrap|Line Numbers
  1. <%
  2. On Error Resume Next
  3.  
  4. Response.Expires=0
  5. Set yaketyConnection=Server.CreateObject("ADODB.Connection")
  6. DatabaseDetails="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("database path.mdb") & ";"
  7. yaketyConnection.Open DatabaseDetails
  8. yaketyQuery="SELECT * FROM celebs WHERE voicetypea like '%"&voiceid&"%' and sex like 'm' or voicetypeb like '%"&voiceid&"%' and sex like 'm' or voicetypec like '%"&voiceid&"%' and sex like 'm' or voicetyped like '%"&voiceid&"%' and sex like 'm' or voicetypee like '%"&voiceid&"%' and sex like 'm' or voicetypef like '%"&voiceid&"%' and sex like 'm' or voicetypeg like '%"&voiceid&"%' and sex like 'm' or voicetypeh like '%"&voiceid&"%' and sex like 'm' or voicetypei like '%"&voiceid&"%' and sex like 'm' or voicetypej like '%"&voiceid&"%' and sex like 'm' or voicetypek like '%"&voiceid&"%' and sex like 'm' or voicetypel like '%"&voiceid&"%' and sex like 'm' or voicetypem like '%"&voiceid&"%' and sex like 'm'  or voicetypen like '%"&voiceid&"%' and sex like 'm' or voicetypem like '%"&voiceid&"%' and sex like 'm' order by surname"
  9. Set yaketyRecordset=yaketyConnection.execute(yaketyQuery)
  10.  
  11. i=yaketyRecordset.recordcount
  12.  
  13. Dim iCount
  14. %>
futher down the page at the top of the visible page to the user i am using the following to show the count

<% Response.Write(i)%>

i know i am doing something wrong but cannot figure out how to correct can anyone help
Jan 30 '08 #1
4 1695
CroCrew
564 Expert 512MB
Hello colinod,

Give this a try:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Set Conn = Server.CreateObject("ADODB.Connection")
  3.     Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Relative path to your Access database") 
  4.     Set yaketyRecordset = Server.CreateObject("ADODB.Recordset")
  5.     SQL = "SELECT * FROM celebs"
  6.     yaketyRecordset.CursorType = 1
  7.     yaketyRecordset.LockType = 3
  8.     yaketyRecordset.Open SQL, Conn
  9.  
  10.     Response.Write("Total Records: " & yaketyRecordset)
  11.     Response.End
  12. %>
  13.  
  14.  
Jan 30 '08 #2
Hello colinod,

Give this a try:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Set Conn = Server.CreateObject("ADODB.Connection")
  3.     Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Relative path to your Access database") 
  4.     Set yaketyRecordset = Server.CreateObject("ADODB.Recordset")
  5.     SQL = "SELECT * FROM celebs"
  6.     yaketyRecordset.CursorType = 1
  7.     yaketyRecordset.LockType = 3
  8.     yaketyRecordset.Open SQL, Conn
  9.  
  10.     Response.Write("Total Records: " & yaketyRecordset)
  11.     Response.End
  12. %>
  13.  
  14.  
hi,
even i m havin same problem wid recordcount so i tried the above code but it showed error of type mismatch
Feb 2 '08 #3
CroCrew
564 Expert 512MB
What does your code look like? Can you copy and paste it here so we can debug it?

Thanks~
Feb 3 '08 #4
JamieHowarth0
533 Expert 512MB
Hi there,

Try using:
Expand|Select|Wrap|Line Numbers
  1. Option Strict
  2.  
  3. 'yakety code goes here
  4.  
  5. Dim i As Integer
  6. If yaketyRecordset.Recordcount > 0 Then 
  7.     i = yaketyRecordset.Recordcount
  8. Else
  9.     i = 0
  10. End If
  11.  
Could be that you have used Option Strict in your application declaration (using Option Strict means you have to declare all variables and their appropriate types before assigning values).

Hope it helps.

medicineworker
Feb 6 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Serge Myrand | last post by:
Hi, I have an ADODB.RecordSet that RecordCount alway return -1 and this RecordSet is plenty of record! R.RecordSet = -1 R.eof = False R.BOF = False Is the cursor is lost somewhere?
0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
2
by: Clark Savage Jr | last post by:
I am running a bunch of aggregate insert queries to populate a table. When I run the SQL statement via a saved query, all is well. However, when I run it as an ADO recordset in VBA, the count is...
4
by: Dalan | last post by:
I presume that using an open recordset method is the preferred method of accomplishing what I'm trying to do. Of course, if there are other options that would work, feel free to share them. I...
2
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
3
by: ruomingxu | last post by:
I have a problem with recordset/SQL statement. The following is the code. Private Sub Command1_Click() Dim SqlQuery As String Dim RcdSet As Recordset Dim cnt As Integer SqlQuery = "SELECT *...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.