How can count RecordSet

J

Jack

Hello,
<%@ Language=VBScript %>
<%
Dim shipment_db
Dim shipmentTable
Set shipment_db = Server.CreateObject("ADODB.Connection")
Set shipmentTable = shipment_db.Execute("SELECT * FROM shipment")
Response.Write shipmentTable.RecordSetCount 'This line is error
%>
But this program can't count recordset.
Thank you
 
B

Bob Barrows

Jack said:
Hello,
<%@ Language=VBScript %>
<%
Dim shipment_db
Dim shipmentTable
Set shipment_db = Server.CreateObject("ADODB.Connection")
Set shipmentTable = shipment_db.Execute("SELECT * FROM shipment")
Response.Write shipmentTable.RecordSetCount 'This line is error
%>
But this program can't count recordset.
Thank you

As you will see in this article, the method you choose to use depends on
your database. Always tell use the type and version of database you are
using.

http://www.aspfaq.com/show.asp?id=2193

For a further explanation of the effect of cursor type on record count, see
here:
http://msdn.microsoft.com/library/en-us/ado270/htm/mdapro05_9.asp

HTH,
Bob Barrows
 
B

Bhaskaran.B

<%
Dim shipment_db
Dim shipmentTable
Set shipment_db = Server.CreateObject("ADODB.Connection")
Set shipmentTable = Server.CreateObject("ADODB.Recordset")
shipmentTable .open "SELECT * FROM shipment", shipment_db ,1,1
Response.Write shipmentTable.RecordCount
%>

Bj.Bhaskaran.B
IGI - SCT
 
B

Bob Barrows

Jack said:
It's myself.
My DataBase is Microsoft Access 2000,linked by ODBC Driver.

Great. :)
Now just remember to provide this information the next time you post a
question.

I do suggest you drop the ODBC driver and use the native Jet OLEDB provider
instead. ODBC is being deprecated, and MS recommends using OLEDB if
available for your database (which it is). See here for connection string
examples:

http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJet

HTH,
Bob Barrows
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top