Total records in database equals -1?

I have some code, accessing an Access database. As part of development I need to see how many total records there are, so I have the code I took off of bindings in CS 5:
          <p align="center">/<%=(Recordset1_first)%>/<%=(Recordset1_last)%>/<%=(Recordset1_total)%></p >
Why would _total always equal -1? The code is otherwise functional but the -1 does not change regardless if I add a record or delete a record?
Curiouser and curiouser…
Ross

I try changing the cursor type and it had no effect whatsoever I also tried looking for a simple "attach" for this posting and could not find one. I therefore attached the full ASP so you could see what kind of stuff I'm talking about. Could you forward this as appropriate?
Thanks.
Ross
=============================code=========================
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/Connections/nextdns.asp" -->
<%
  dim MM_nextdns_STRING
      MM_nextdns_STRING ="PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\ids2.mdb")
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End I
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' *** Redirect if username exists
MM_flag = "MM_insert"
If (CStr(Request(MM_flag)) <> "") Then
  Dim MM_rsKey
  Dim MM_rsKey_cmd
  MM_dupKeyRedirect = "/already.asp"
  MM_dupKeyUsernameValue = CStr(Request.Form("11"))
  Set MM_rsKey_cmd = Server.CreateObject ("ADODB.Command")
  MM_rsKey_cmd.ActiveConnection = MM_nextdns_STRING
  MM_rsKey_cmd.CommandText = "SELECT id2 FROM login2 WHERE id2 = ?"
  MM_rsKey_cmd.Prepared = true
  MM_rsKey_cmd.Parameters.Append MM_rsKey_cmd.CreateParameter("param1", 200, 1, 255, MM_dupKeyUsernameValue) ' adVarChar
  Set MM_rsKey = MM_rsKey_cmd.Execute
  If Not MM_rsKey.EOF Or Not MM_rsKey.BOF Then
    ' the username was found - can not add the requested username
    MM_qsChar = "?"
    If (InStr(1, MM_dupKeyRedirect, "?") >= 1) Then MM_qsChar = "&"
    MM_dupKeyRedirect = MM_dupKeyRedirect & MM_qsChar & "requsername=" & MM_dupKeyUsernameValue
    Response.Redirect(MM_dupKeyRedirect)
  End If
  MM_rsKey.Close
End If
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<%
If (CStr(Request("MM_insert")) = "form3") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_nextdns_STRING
    MM_editCmd.CommandText = "INSERT INTO login2 (id2, password2, AccessLev) VALUES (?, ?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("11")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("22")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(Request.Form("accesslev"), Request.Form("accesslev"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
  End If
End If
%>
<%
' *** Delete Record: construct a sql delete statement and execute it
If (CStr(Request("MM_delete")) = "form2" And CStr(Request("MM_recordId")) <> "") Then
  If (Not MM_abortEdit) Then
    ' execute the delete
mm_nextdns_string = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\ids2.mdb")
       Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_nextdns_STRING
    MM_editCmd.CommandText = "DELETE FROM login2 WHERE id2 = ?"
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 200, 1, 255, Request.Form("MM_recordId")) ' adVarChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
  End If
End If
%>
<%
If (CStr(Request("MM_insert")) = "form3") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
   MM_nextdns_string = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\ids2.mdb")
     MM_editCmd.ActiveConnection = MM_nextdns_STRING
    MM_editCmd.CommandText = "INSERT INTO login2 (id2, password2) VALUES (?, ?)"
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("121212")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 255, Request.Form("343434")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl0
    MM_editRedirectUrl = "inserted.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim delit_total
Dim delit_first
Dim delit_last
' set the record count
' set the number of rows displayed on this page
If (delit_numRows < 0) Then
  delit_numRows = delit_total
Elseif (delit_numRows = 0) Then
  delit_numRows = 1
End If
' set the first and last displayed record
delit_first = 1
delit_last  = delit_first + delit_numRows - 1
' if we have the correct record count, check the other stats
If (delit_total <> -1) Then
  If (delit_first > delit_total) Then
    delit_first = delit_total
  End If
  If (delit_last > delit_total) Then
    delit_last = delit_total
  End If
  If (delit_numRows > delit_total) Then
    delit_numRows = delit_total
  End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
response.write("precount")
If (Recordset1_total = -1) Then
  ' count the total records by iterating through the recordset
  Recordset1_total=0
response.write("incount")
   While (Not Recordset1.EOF)
    Recordset1_total = Recordset1_total + 1
    Recordset1.MoveNext
  Wend
  ' reset the cursor to the beginning
  If (Recordset1.CursorType > 0) Then
    Recordset1.MoveFirst
  Else
    Recordset1.Requery
  End If
  ' set the number of rows displayed on this page
  If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If
  ' set the first and last displayed record
  Recordset1_first = 1
  Recordset1_last = Recordset1_first + Recordset1_numRows - 1
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If
End If
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("idid2"))
If MM_valUsername <> "" Then
  Dim MM_fldUserAuthorization
  Dim MM_redirectLoginSuccess
  Dim MM_redirectLoginFailed
  Dim MM_loginSQL
  Dim MM_rsUser
  Dim MM_rsUser_cmd
  MM_fldUserAuthorization = ""
  MM_redirectLoginSuccess = "file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/g.asp"
  MM_redirectLoginFailed = "file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/b.asp"
  MM_loginSQL = "SELECT id2, password2"
  If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
  MM_loginSQL = MM_loginSQL & " FROM login2 WHERE id2 = ? AND password2 = ?"
  Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
  MM_rsUser_cmd.ActiveConnection = MM_nextdns_STRING
  MM_rsUser_cmd.CommandText = MM_loginSQL
  MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 255, MM_valUsername) ' adVarChar
  MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 255, Request.Form("pwd2")) ' adVarChar
  MM_rsUser_cmd.Prepared = true
  Set MM_rsUser = MM_rsUser_cmd.Execute
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("asd1"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization = ""
  MM_redirectLoginSuccess = "file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/g.asp"
  MM_redirectLoginFailed = "file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/b.asp"
  MM_loginSQL = "SELECT id2, password2"
  If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
  MM_loginSQL = MM_loginSQL & " FROM login2 WHERE id2 = ? AND password2 = ?"
  Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
  MM_rsUser_cmd.ActiveConnection = MM_nextdns_STRING
  MM_rsUser_cmd.CommandText = MM_loginSQL
  MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 255, MM_valUsername) ' adVarChar
  MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 255, Request.Form("asd2")) ' adVarChar
  MM_rsUser_cmd.Prepared = true
  Set MM_rsUser = MM_rsUser_cmd.Execute
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_nextdns_STRING
Recordset1_cmd.CommandText = "SELECT * FROM login2"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<!--#include virtual="/includes/adovbs.inc" -->
<%
Repeat1__numRows = 20
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim Recordset1_total
Dim Recordset1_first
Dim Recordset1_last
' set the record count
Recordset1_total = Recordset1.RecordCount
' set the number of rows displayed on this page
If (Recordset1_numRows < 0) Then
  Recordset1_numRows = Recordset1_total
Elseif (Recordset1_numRows = 0) Then
  Recordset1_numRows = 1
End If
' set the first and last displayed record
Recordset1_first = 1
Recordset1_last  = Recordset1_first + Recordset1_numRows - 1
' if we have the correct record count, check the other stats
If (Recordset1_total <> -1) Then
  If (Recordset1_first > Recordset1_total) Then
    Recordset1_first = Recordset1_total
  End If
  If (Recordset1_last > Recordset1_total) Then
    Recordset1_last = Recordset1_total
  End If
  If (Recordset1_numRows > Recordset1_total) Then
    Recordset1_numRows = Recordset1_total
  End If
End If
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUsername=CStr(Request.Form("idid2"))
If MM_valUsername <> "" Then
  MM_fldDynamicRedirect=""
  MM_fldUserAuthorization="AccessLev"
  MM_redirectLoginSuccessDynamic="file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712- 4265-839B-02EB4947FC25}/g.asp"
  MM_redirectLoginFailed="file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839 B-02EB4947FC25}/b.asp"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_nextdns_STRING
  MM_rsUser.Source = "SELECT id2, password2"
  If MM_fldDynamicRedirect <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldDynamicRedirect
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM login2 WHERE id2='" & Replace(MM_valUsername,"'","''") &"' AND password2='" & Replace(Request.Form("pwd2"),"'","''") & "'"
  MM_rsUser.CursorType = 0
  MM_rsUser.CursorLocation = 2
  MM_rsUser.LockType = 3
  MM_rsUser.Open
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    ElseIf (MM_fldDynamicRedirect <> "") Then
      MM_redirectLoginSuccessDynamic = CStr(MM_rsUser.Fields.Item(MM_fldDynamicRedirect).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccessDynamic = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccessDynamic)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
    background-image: url(/graphics/spackle.gif);
.ctable {
    border-top-style: solid;
    border-right-style: solid;
    border-bottom-style: solid;
    border-left-style: solid;
</style>
<script src="/SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="/SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="160" border="1">
  <tr>
    <td width="106"><p><img src="/graphics/coed1.jpg" width="42" height="53" alt="coed1" /></p>
      <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_cart" />
        <input type="hidden" name="add" value="1" />
        <input type="hidden" name="bn" value="webassist.dreamweaver.4_5_0" />
        <input type="hidden" name="business" value="[email protected]" />
        <input type="hidden" name="item_name" value="aaaa" />
        <input type="hidden" name="item_number" value="aaaa" />
        <input type="hidden" name="amount" value=".12" />
        <input type="hidden" name="currency_code" value="USD" />
        <input type="hidden" name="cancel_return" value="http://heritage.site88.net/badorder.asp" />
        <input type="hidden" name="receiver_email" value="[email protected]" />
        <input type="hidden" name="mrb" value="R-3WH47588B4505740X" />
        <input type="hidden" name="pal" value="ANNSXSLJLYR2A" />
        <input type="hidden" name="no_shipping" value="0" />
        <input type="hidden" name="no_note" value="0" />
        <input type="image" name="submit" src="http://images.paypal.com/images/sc-but-03.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!" />
    </form></td>
    <td width="16"> </td>
    <td width="16"> </td>
  </tr>
  <tr>
    <td> </td>
    <td><img src="/graphics/coed1.jpg" width="14" height="18" alt="coed1" /></td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
    <td><img src="/graphics/coed1.jpg" width="20" height="31" alt="coed1" /></td>
  </tr>
</table>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <div align="center">
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="display" value="1" />
    <input type="hidden" name="bn" value="webassist.dreamweaver.4_5_0" />
    <input type="hidden" name="business" value="[email protected]" />
    <input type="hidden" name="receiver_email" value="[email protected]" />
    <input type="hidden" name="mrb" value="R-3WH47588B4505740X" />
    <input type="hidden" name="pal" value="ANNSXSLJLYR2A" />
    <input type="image" name="submit" src="http://images.paypal.com/images/view_cart_02.gif" border="0" alt="Make payments with PayPal - it's fast, free and secure!" />
 </div>
</form>
<p> </p>
<table width="492" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td width="63"><label for="recnum6">Recnum</label></td>
    <td width="101"> ID</td>
    <td width="154">Password </td>
    <td width="164">AccessLev</td>
  </tr>
</table>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<td><input name="recnum" type="text" id="recnum" value="<%=(Recordset1.Fields.Item("recnum").Value)%>" size="10" /></td>
<td><input name="idid" type="text" id="idid" value="<%=(Recordset1.Fields.Item("id2").Value)%>" size="10" /></td>
<td><input name="pwd" type="text" id="pwd" value="<%=(Recordset1.Fields.Item("password2").Value)%>" /></td>
<td><input name="accesslev" type="text" id="accesslev" value="<%=(Recordset1.Fields.Item("AccessLev").Value)%>" /></td>
<label for="accesslev"></label>
<%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
  response.write("<br>")
Wend
%>
<p align="center">/<%=(Recordset1_first)%>/<%=(Recordset1_last)%>/<%=(Recordset1_total)%>/</ p>
<p align="center"> </p>
<form id="form4" name="form4" method="post" action="file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/ inscust.asp">
  <div align="center">
    <input type="submit" name="register" id="register" value="Register as New User" />
  </div>
</form>
<p align="center">-or- </p>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
  <label for="idid2">                                                                      ID:</label>
  <input type="text" name="idid2" id="idid2" />
  <label for="pwd2">Pwd:</label>
  <input type="password" name="pwd2" id="pwd2" />
  <input type="submit" name="login" id="login" value="Login" />
  <a href="file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/re gister.asp">
  </a>
</form>
<form action="<%=MM_editAction%>" method="POST" id="form3" name="form3">
    <label for="11">IdId:</label>
    <input type="text" name="11" id="11" />
    <label for="22">Password2:</label>
    <input type="password" name="22" id="22" />
  <label for="accesslev">AL:</label>
  <input name="accesslev" type="text" id="accesslev" value="2" size="1" maxlength="1" />
  <input type="submit" name="insins" id="insins" value="Insert" />
    <input type="hidden" name="MM_insert" value="form3" />
  </p>
</form>
<p></p>
<p></p>
<form ACTION="file:///C|/Users/Admin/AppData/Local/Temp/{C0C804DA-3712-4265-839B-02EB4947FC25}/ dodel.asp" METHOD="POST" id="form2" name="form2">
  <label for="delrec">Recnum:</label>
  <input type="text" name="delrec" id="delrec" />
  <input type="submit" name="deleir" id="deleir" value="Delete" />
</form>
<p></p>
<p>
  <script type="text/javascript">
function zappaypalcookies()
    alert("called");
    alert(document.cookie.length);
    alert(document.cookie);
    document.cookie="fred=sam";
        alert(document.cookie);
  </script></p>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

Similar Messages

  • Total number of record in database??

    Hi,
    How to find total number of record in database using Single Query/Statement?
    Thanks

    Here we go, in a Single Statement Block
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    v_cnt NUMBER := 0;
      3    v_tot NUMBER := 0;
      4    CURSOR cur_tables IS
      5      SELECT table_name FROM user_tables;
      6  BEGIN
      7    DBMS_OUTPUT.ENABLE(1000000);
      8    FOR t IN cur_tables
      9    LOOP
    10      EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM '||t.table_name INTO v_cnt;
    11      v_tot := v_tot + v_cnt;
    12    END LOOP;
    13    DBMS_OUTPUT.PUT_LINE('Total Table Rows: '||v_tot);
    14* END;
    SQL> /
    Total Table Rows: 5850553
    PL/SQL procedure successfully completed.
    SQL>What use it is is anybody's guess.
    Note: This only works on the users own tables, not all the system tables or tables from other schemas in the database.

  • How to get the total record count for the report

    Hi,
    How can I get count of the total records shown in the report. When we set the report attributes, we have an option "Set Pagination from X to Y of Z"
    Does anyone know how can I get the Z value from APEX variables.
    I know we can use that query and get the count but I just want to know how we can use APEX Variables effectively.
    Thanks in advance.

    You write a loop, something like this:
    Go_block('B1');
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    First_Record;
    If not form_success then
      Raise Form_Trigger_failure;
    End if;
    Loop
      If :system.record_status in('CHANGED','INSERT') then
        -- modify the record here--
      End if;
      Exit when :System.Last_Record = 'TRUE';
      Next_Record;
    End Loop;
    First_Record;But be very careful-- If your block can fetch a large number of rows, (over 100), this loop can take a long time, and you should not use this method. The loop will continue fetching more rows from the database until all rows satisfying the query are retrieved.

  • No of records in SAP BI Corresponds to how many records in database

    Dear all
                   If i have 2lakh records in a datasource  then how it  Corresponds to how many records in database.

    For the first time load the datasource , the no of records in the database(source) must be equal to the number of records in the PSA(datasource).
    If you are daily deleting the records in the PSA , and doing a delta load then the no of records in PSA must be equal to the no of records in delta queue RSA7 for the corresponding datasource .
    If the load is a full load everytime or a full repair  ,then the no of  records in PSA  must be equal to the numbers of records in source.

  • PM Orders whose total actaul quantity is equal to withdrawl quantity

    hello all,
    our requirement is we are generating an ALV  report to show PM Orders whose total actual quantity is equal to total withdrawn quantity...
    i.e it should not display records like below,
    RSNUM     material         BDMNG        SHKZG   ENMNG
    800268591   *****             3                   H                3
    800268591    ****             3                   S                0
    800268591     ***             3                   H                0
    800268591   *****             3                  S                 3
    where as the report should show only records like below...
    RSNUM     material         BDMNG        SHKZG   ENMNG
    8000208770  MTE30001     50                 H           50
    8000208770  MTE30001     50                 S            50
    8000208770  MTO10020     20                 H            20
    8000208770  MTO10020     20                 S            20.
    i.e each material wise i should check this ,
    my code is like below
    loop at it_resb INTO wa_resb.
           if wa_resb-shkzg eq 'H'.
                lv_bdmng1 = lv_bdmng1 + wa_resb-bdmng.
                lv_enmng1 = lv_enmng1 + wa_resb-enmng.
            ELSEIF wa_resb-shkzg eq 'S'.
                lv_enmng2 = lv_enmng2 + wa_resb-enmng.
                lv_bdmng2 = lv_bdmng2 + wa_resb-bdmng.
           endif.
         endloop.
         if lv_bdmng1 eq lv_bdmng2 AND lv_enmng1 eq lv_enmng2.
             if lv_enmng1 ne 0 and lv_enmng2 ne 0.
               APPEND  LINES OF it_resb  to it_resb1.
             endif.
         endif.
       endif.
      endloop.

    clear lv_bdmng1 and lv_bdmng2 in first line inside loop stat.

  • Total records not shown in bottom panel

    Hi all,
    I am running Forms 10g. When my forms runs, the total record count does not shown in the bottom panel but a question mark instead. For example it would show 1/?
    Could you tell me why it would do that?
    Thank you.

    This is because forms do not know, how many records will be retrieved from the database.
    If you go to the last record, forms will show you how many records are in your block.
    You can set the Query All Records block-property to yes to see immediately how many records there,
    but if there are a lot of records to fetch, it might results in a long query time.

  • UDF for Total records

    Hi
    I have a scenario where sender is file. In file there is a field Total records.
    I need to validate Total records field with the total records in the file using UDF..
    Can any suggest me the how to write the cod efor this..
    venkat

    Hi Venkatesh,
    In your source structure should Detail Records count  equal to Total Record Count?
    if yes,just create <b>Context</b> UDF and pass the following 2 inputs
    1. <b>DetailRecord</b> -> RemoveContext
      2. <b>TotalRecord</b>
    and inside UDF write java code for validation
    suppose if your inputs are a[](DetailRecord) and b[](TotalRecord)
      int scnt = a.length;
      int tcnt = Integer.parseInt(b[0]);
      if( scnt != tcnt)
           //write code to trigger an alert(from the following weblog)
    To Trigger alert from UDF just go through the following weblog
    /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
    Cheers,
    Jag

  • Profit center accounting totals records report 2KEE:

    Hi,
    When I am executing Profit center accounting totals records report 2KEE for a specific selection as below,
    Record type: 0
    Version: 0
    Controlling area:
    Company code:
    Posting period :1
    Fiscal year:2007
    Profit center: 1000dummy
    Account:
    After report is generated and if drill down further, line items total is not matching with the report page, breakup gives different values but not the report value.
    I tried report even after implementing OSS 892779 and 952263 but the result is same.  I am using 4.7
    Request your help in this.
    Regards,
    Lakshmana Rao

    Dear Eugene,
    What do you mean? What is the report?

  • How to print all records in database ?

    Hello,
    I am developing a small Database System. Which is used to store some information about student and then print that record, which I want to print. I have used JPanel for Printing single record. As like When I insert student id in TextBox. which is unique. then Click on Search button that is use for searching Record from database. After that the information shown in belowing JPanel. Then using one button for printing this record. It is printing only one record that I have searched. Now what is the problem, I want to print All record from database(can be 500 or 5000) without mentioning any student id in textbox.
    Any type of help Appreciated.
    Thanks in advance.
    Manveer

    Hello Manveer,
    your problem is neither Swing-related or in any other way java specific.
    If you manage to get the data of one student, excellent. Now modify your db-query in the way that the result set returns all students. Loop over the result set and print as usual.

  • Record count per page , total record count per report in BI Publisher

    hi,
    In Oracle BI Publisher tool , can you please tell me how to display total record count of a report ? as well as how to display record count per page ?
    Thanks for your help
    Regards
    Gayathri

    check inbox. forwarded the updated template

  • Entity Framework doesn't save new record into database

    Hy,
    I have problem with saving new record into database using Entity Framework.
    When I run program, everything seems normal, without errors . Program shows existing, manually added records into the database, and new one too. But new one isn't save into database after running program.
    I've got no idea where's problem. There is code for add new record, show existing.
    Thanks for help!!
    // add new record
    using (var db=new DatabaseEntitiesContext())
    var person = new Table()
    First_Name = "New_FName",
    Second_Name = "New_SName",
    PIN = "4569"
    db.Tables.Add(person);
    db.SaveChanges();
    //show all records
    using (var db=new DatabaseEntitiesContext())
    var selected = from x in db.Tables
    select x;
    foreach (var table in selected)
    Console.WriteLine("{0}{1}{2}",table.First_Name,table.Second_Name,table.PIN);

    Hi BownieCross;
    If you are using a local database file in your project the following may be the cause.
    From Microsoft Documentation:
    Issue:
    "Every time I test my application and modify data, my changes are gone the next time I run my application."
    Explanation:
    The value of the Copy
    to Output Directory property is Copy
    if newer or Copy
    always. The database in your output folder (the database that’s being modified when you test your application) is overwritten every
    time that you build your project. For more information, see How
    to: Manage Local Data Files in Your Project.
    Fernando (MCSD)
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects
    and unknown namespaces.

  • The ABAP/4 Open SQL array insert results in duplicate Record in database

    Hi All,
    I am trying to transfer 4 plants from R/3 to APO. The IM contains only these 4 plants. However a queue gets generated in APO saying 'The ABAP/4 Open SQL array insert results in duplicate record in database'. I checked for table /SAPAPO/LOC, /SAPAPO/LOCMAP & /SAPAPO/LOCT for duplicate entry but the entry is not found.
    Can anybody guide me how to resolve this issue?
    Thanks in advance
    Sandeep Patil

    Hi Sandeep,
              Now try to delete ur location before activating the IM again.
    Use the program /SAPAPO/DELETE_LOCATIONS to delete locations.
    Note :
    1. Set the deletion flag (in /SAPAPO/LOC : Location -> Deletion Flag)
    2. Remove all the dependencies (like transportation lane, Model ........ )
    Check now and let me know.
    Regards,
    Siva.
    null

  • Total record display in resultlist (interaction history)

    Hi all,
    May I know how can I add the total search data so that it can display in the interaction history page to show the total record found?
    In most cases, like in Activity, it will show the total record found in resultlist. But not in interaction history page.
    Can anyone advise?
    Thanks

    I am using version 5.2 so I am not really sure if it is exactly the same in 6.0 (aka 2007). Try searching the IMG. Or wait for someone else to reply to this tread
    /Anders

  • Fetch records from Database based on Input value

    Hi Experts,
    In my mobile application, I have designed one input field with F4 help or input assist. I need to fetch records from database based on that input and need to display records in table.
    My question is:
    How to fetch the records from database/back end based on the input value and display them as table format as we are doing in SAP ABAP?
    Here, I need to fetch the records based on input value available in the UI screen and pass that value to gateway, fetch the records from database and need to bind with table in SAPUI5.
    Kindly share the whole process flow with sample code for this requirement. Hope I have explained the requirement in detail.
    Thanks In Advance..
    Regards,
    Arindam Samanta.

    Hi,
    Try something like this.
    In this, I am passing From date, To date, RelGrp, RelStr, Uname as input. Then I am storing those values in variables and passing this data in Odata request.
    OData.read({ requestUri: "http://xxxx:8000/sap/opu/odata/sap/Z188_PO_SRV/pos?$filter=Docdate le datetime'"
                    + todateformat+"T00:00:00' and Docdate ge datetime'"
                    + fromdateformat+"T00:00:00' and RelGrp eq '"
                    + relcode +"'and RelStr eq '"
                    + relstg +"'and Uname eq '"
                    + username+ "' "},
      function (data) {
    console.log(data);
    When we are giving correct inputs it will goes to Success function and get the data from back end.
    In console we can see the data.
    Hope this will helps to you.
    Thanks&Regards
    Sridevi

  • Add a new record in database table without using table maintance generator

    Hi Expart ,
                  Plz. tell me how to add new record in database table without using table maintance ganerator ....give me one ex.
    Regards
    Bhabani

    Hi,
    The other way to safely handle the modification of tables is through is by programs that can be done with SE38 or SE80.
    To insert into database table we use INSERT statement :
    1. To insert a single line into a database table, use the following:
    INSERT INTO <target> VALUES <wa>.
    INSERT <target> FROM <wa>.
    2. To insert a several lines into a database table, use the following:
    INSERT <target> FROM TABLE <itaba>.
    Or even we can use MODIFY statementas this single statement is used to insert as well as update the records of database table.
    MODIFY <target> FROM <wa>.
    or MODIFY <target> FROM TABLE <itab>.
    thanx.
    Edited by: Dhanashri Pawar on Sep 10, 2008 12:25 PM
    Edited by: Dhanashri Pawar on Sep 10, 2008 12:30 PM

Maybe you are looking for

  • System ask me old owner's password

    Hello. iPhone 4S 16 gb black SN: DN****T9Y I have some problem with activation of my iPhone after iOS 7 installation. System ask me old owner's password & ID, but I don't know it and can't restore! Can You reset or take off this function and help me?

  • Does Keynote have a "fit show to music" option?

    Dear Apple Community, When creating slideshows in iPhoto, one can use the "fit show to music."  Does Keynote have a similiar feature? Thanks, Leland Nunes

  • Inventory Extractors BF and UM

    When we talk about valuated and unvaluated stock when filling the setup tables what do we mean? Thanks

  • Sign applet problem

    Hi, I am following the 10 steps by irene to sign the applet. When I go to number 10, if I want to use self-signed certificate, then i need to import self-signed certificate into the cacerts keystore. However, I don't want my clients to do this thing

  • Imac monitor color has color shifts

    I have 40 new imac duel core machines. all monitors have been calibrated using the apple system........not great but a start. some of the machines show a color bias when the grey in an image reaches 70 to 80 %. this bias occurs in Illustrator and vec