Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone know the syntax to call an asp subroutine

Status
Not open for further replies.
Apr 22, 2008
9
0
0
US
I have a queue page that counts the number of records based on a certain query to an sql database. It does not update efficiently and I think what I need to do is have an asp subroutine that recalculates everytime a command button is pressed and then does a response.write for the value. Any ideas how to do this?
 
What if the button is a submit button for an HTML form?
 
I want to have a command button that on the onclick event gives me a count of this sql/asp code:
<% zero = "SELECT * FROM IVRADM.T_FLFORM_DAT_EMPLOYEE_Quality WHERE (Quality_Status='Sent to Supervisor') AND (Total_Quality_Score=0) AND Supervisory_Employee_ID = '" & user_id & "' ORDER BY Start_datetime" %>
<% Set cnLink5 = Server.CreateObject("ADODB.Connection") %>
<% cnLink5.Open "FILEDSN=D:\Inetpub\DSN\Form.dsn" %>
<% set rsLink5 = Server.CreateObject("ADODB.Recordset") %>
<% rsLink5.Open zero, cnLink5, 3, 3 %>
<% zerocount = 0 %>
<% DO WHILE Not rsLink5.EOF %>
<% rsLink5.MoveNext %>
<% zerocount = zerocount + 1 %>
<% Loop %>
<% rsLink5.Close %>
<% Set rsLink5 = Nothing %>
<% cnLink5.Close %>
<% set cnLink5 = Nothing %>
 
Rather than doing your query, loading the recordset, and then counting the records in the recordset, why don't you just count them in the query (assuming they are unique)?

Then you "command button" will just reload the page, reexecuting the query.

Might be faster.
 
if you're looking just for the count of records,
you can also do:
SELECT count(*) FROM IVRADM.T_FLFORM_DAT_EMPLOYEE_Quality
instead of reading the whole recordset.
cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top