How do I display last record in database?

I have a asp guestbook form that I finally have working only
when the info is sent to me via email, it shows me the first entry
in the database each time. How do I get it to select/email only the
last entry?
Any advice is appreciated!

"innovationlab" <[email protected]> wrote in
message
news:e8u951$1ll$[email protected]..
> Can't really be sorted, it just has name, email and
message.
Then you have no way of knowing which is the last record. You
need an
autonumber field or a date/time field in order to be able to
sort the
records so you know which one is the last.
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/
Cartweaver Development Team
http://www.cartweaver.com
Extending Knowledge Daily
http://www.communitymx.com/

Similar Messages

  • Fetch last record from database table

    hi,
    how to fetch last record from database table.
    plz reply earliest.
    Regards,
    Jyotsna
    Moderator message - Please search before asking - post locked
    Edited by: Rob Burbank on Dec 11, 2009 9:44 AM

    abhi,
    just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
    any ways,
    jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
    you can select max or that field or order by descending using select single.
    or get all data.. sort in descending order.(again you need some criteria like date).
    read the first entry. using read itab index 1

  • How to restrict the last record and not moving to next reocrd

    1) how to restrict the last record and not moving to next reocrd.
    2) Also for the F6 key(for new record).

    When you are on the last record, next-record will create a new one, so that my question is do you want to forbid new record creation.
    Francois

  • How to to display entire records using PL/SQL(anoyomous block)

    Hi All,
    I have created a region of type PL/SQL by using rownum, and it wil display few records due to rownum.
    But the end user is asking to display the rest of records also using some pagination concept or any other way.
    How can we achieve this?
    In mean time i have tried to execute the by removing the rownum, then it is throwing the below Query
    Error- ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
    Thanks,
    Ano.
    Edited by: Anoo on Mar 19, 2012 12:18 AM

    Hi,
    Here is the query we are using to dsipaly the records, but the limit we are dsiplaying is only 300.
    So the concern is how we can display all records.
    DECLARE
    list_arr2 htmldb_application_global.vc_arr2;
    p VARCHAR2(4000);
    v_default_start_date DATE;
    j NUMBER :=0;
    occurrencies NUMBER(10);
    CODESELECT VARCHAR2(7);
    BEGIN
    IF :P2_SYMBOL_CODE_HIDDEN IS NOT NULL THEN
    CODESELECT:=:P2_SYMBOL_CODE_HIDDEN;
    ELSE
    CODESELECT:='';
    END IF;
    Select TO_char(SYSDATE-1,'MM/DD/YYYY') into v_default_start_date from Dual;
    :P2_START_DATE := v_default_start_date; */
    list_arr2 := htmldb_util.string_to_table (:P2_SYMBOL_NAME, ',');
    p := 'SELECT SYMB_SARUS_DESCRIPTION,SYMB_CODE FROM ( '
    || 'SELECT '''' SYMB_SARUS_DESCRIPTION,''NA'' SYMB_CODE FROM DUAL ';
    p := p
    || ' UNION all SELECT sym.SYMB_SARUS_DESCRIPTION || ''- '' '
    || ' || sym.SYMB_CODE SYMB_SARUS_DESCRIPTION , sym.SYMB_CODE '
    || ' from T_SYM sym ';
    IF :P2_ACTIVESYMBOL='ACTIVE ONLY' THEN
    p := p || ', ( SELECT distinct DSPS_SYMB_CODE FROM t_dispatch_symbol ' ||
    ' WHERE dsps_dsp_code IN ( SELECT adsp_dsp_code ' ||
    ' FROM t_aut ' ||
    ' WHERE adsp_vend_code=''FTP'' ' ||
    ')) act_symb ' ||
    ' WHERE sym.SYMB_CODE=act_symb.DSPS_SYMB_CODE AND ';
    ELSIF :P2_ACTIVESYMBOL='INACTIVE' THEN
    p := p || ', ( SELECT distinct DSPS_SYMB_CODE FROM t_dis ' ||
    ' WHERE dsps_dsp_code NOT IN ( SELECT adsp_dsp_code ' ||
    ' FROM t_aut ' ||
    ' WHERE adsp_vend_code=''FTP'' ' ||
    ')) act_symb ' ||
    ' WHERE sym.SYMB_CODE=act_symb.DSPS_SYMB_CODE AND ';
    ELSE
    p := p || ' WHERE ';
    END IF;
    p := p || 'UPPER(sym.SYMB_SARUS_DESCRIPTION) LIKE ';
    FOR i IN 1 .. list_arr2.COUNT
    LOOP
    IF i = 1
    THEN
    p := p || ' UPPER(''%' || TRIM(list_arr2 (i)) || '%'') ';
    ELSE
    p :=
    p
    || ' AND UPPER(SYMB_SARUS_DESCRIPTION) LIKE '
    || ' UPPER(''%'
    || TRIM(list_arr2 (i))
    || '%'') ';
    END IF;
    END LOOP;
    p := p || ' order by 1 ) where rownum < 310 ';
    p := REPLACE(p, '''||''', '||');
    IF LENGTH(:P2_SYMBOL_NAME) > 2 AND :P2_HIDD = 'cdf' THEN
    htp.p('<table>');
    htp.p('<tr bgcolor=white><td width=20% align="left">');
    htp.p('<font color="#094991" size="1">     Search By Name</font>');
    htp.p('</td>');
    htp.p('<td align="left">');
    htp.p(APEX_ITEM.SELECT_LIST_FROM_QUERY(3,CODESELECT,p,'onChange="setSymbolCode(this.value);" size=10','NO','','','P2_SEARCHNAME','','Select'));
    htp.p('</td>');
    htp.p('</tr>');
    htp.p('</table>');
    END IF;
    IF LENGTH(p)<=0 THEN
    :P2_SYMBOL_CODE_HIDDEN:='';
    END IF;
    END;
    Thanks,
    Anoo.
    Edited by: Anoo on Mar 19, 2012 1:10 AM

  • How to find the last records of the table in adventure work db

    hi all,
    i want to find out " how to receive a last records of the table (eg:  person.emailaddress ) in sql 2008 and 2005"
    Thanks

    If you are looking for the latest record( the one which got inserted/modified last) then use this query
    select top 1 * from person.emailaddress
    Order by ModifiedDate desc
    Satheesh
    My Blog |
    How to ask questions in technical forum

  • How to get the last record from the database

    I am using MS Access database and Swings as GUI. I want to get the last record of a particular column from the table and store it as a varaible.

    Hi
    To get Last record of resultset, you have pass some parameter in constructor of CreateStatement.In such case Resultset should be scrollable and Readonly
    Example
    objStatement=objCon.createStatement ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    mwwResultSet=cwwStatement.executeQuery(mwwSqlQuery);
    while(mwwResultSet.next())
    if(mwwResultSet.isLast())
    //Fetch the required column record.
    String abc=mwwResultSet.getString(1);
    I think this will work. Try it.
    bye

  • How to get the last record??

    Hi, I now have to get only the last record from one table
    from MS Access.
    I was looking for the useful method from API, however,
    I cannot get it.
    How to get only the last record from one table ???
    Please help, thanks.

    In RDBMS, row order is really not relavent by iteself. Meaning there is no such thing as 'last record' unless it's in the context of a column (e.g. timeStamp).
    Of course, rows are inserted and stored in some natural order, but you cannot assume they'll come back the same way in a 'Select *' as they were entered.
    So, if you mean last row as in last inserted row, I would add a timestamp field that's set at insert, or use a autonumber column. Either way, have a column that will always contain the highest number or newest timestamp, and then you can build your where clause from that.
    For instance, in Access, I have an autonumbered field called 'fred', with other columns. If I want the last record, I simply use the following:
    select * from atable where fred in (SELECT max(fred) AS Max FROM atable);
    the 'where in' clause will filter to only those records in the subsequent select statment, which of course is only one, the max of the column fred.
    bRi

  • How can one display 1 record at a time

    How can one display a single record at a time.
    The next record should be displayed on the press of a button.
    Thanks in advance

    Vijaya,
    I have 3 regions, each contains a check box item,
    the label for which is dynamicaly generated through a SQL Select.
    ( &P1_ANSWER1. P1_ANSWER1 is the hidden item name)
    In the Region Source,
    I have put
    SELECT col1 from (SELECT col1, row_number() over(ORDER BY col1) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
    SELECT col3 from (SELECT col3, row_number() over(ORDER BY col3) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
    for each of the reqion that contains these items,
    Here the table is prototype and P1_QUESTION_NO is the hidden item.
    As directed I have included under Processes (after submit and computations) on button "Next Record" clicked:
    :P1_QUESTION_NO := ::P1_QUESTION_NO + 1;
    When I am doing this, the label seems to blank out.
    Thanks
    Message was edited by:
    faq123

  • Display last record

    Hi,
    there are 2 fields Transaction No & Activity No.
    data display for Transaction No will be like below:
    Trans No | Act No
    1000001  | 01
    1000001  | 02
    1000001  | 03
    1000001  | 01
    in report I need to show only last record (1000001  | 01) details.
    is it possible.
    can I do this in desinger?
    where should I write code in Bi??
    regards,
    kv

    Hi,
    i dont think any idea in designer. but in ur cube , add one more field and in routine sort the values and
    only for the last record  marked as 'X' in ur new field .then in ur query , u can give condn wen 'x' like ....
    just make a try.
    thnks.

  • How i can Insert selected records in database table using check box.

    Hi Friends,
    I have non database block, which displayed multiple records, now I add a Check Box to this block and now I want to insert the records in a database table which I checked. So when I press a button, all the checked records are inserted in the table.
    Please send me the code of this solution.
    Thanks in advance.
    Shahzad

    I have almost the exact scenario but instead of inserting into the DB, I want to find the Checked records and process them in PL/SQL script.
    I currently have a cursor that looks for all the checked records. It's only getting the first record, so I figured I need to loop through the block looking for checked records.
    Also can I save them to a temp or PL/SQL table to process later?

  • How can I display all records as a end user?

    I am applying for jobs with the state and every week they publish a list of new positions that have just been posted on the following link: https://forms.spb.ca.gov/bulletins/weekly.cfm
    and also at http://jobs.spb.ca.gov/wvpos/search_p_ejv.cfm?classcode=5393&criteria=associate%20governme ntal
    It is a .cfm but only displays 15 records at a time, I was wondering if there is a tag or way to have it display all 300 something records at once?  My ultimate goal is to get just the full table into a excel spreadsheet while retaining the HTML formatting so the links still work.
    My thought is that the state has set it up this way to only display a set number of records at a time, the data is not private or protected, I am simply seeking a easier way to access it in aggregate.
    Thank you in advance for your suggestions and help!

    I think your best hope is to ask the author of the CFM whether they provide any web service that can get you that data when you call it.  like.
    https://forms.spb.ca.gov/webservice.cfc?method=getJobsPostings&key={key_goes_here}
    There's a chance they may be regulating performance on the resultset, and don't want to return that many records at a time, pagination or not.

  • How to get the last record of an internall table ....

    Hi All..
    i want to get the last record of an internal table itab, and i want the the value of the last record.

    Hi,
         Use describe statment.
    data: lv_line type i.
        Describe table itab lines lv_line.
        read table itab into wa_itab index lv_line.
    regards,
    Santosh Thorat

  • How to determine the last record inserted

    hi
    I have a table abc ( x number, y number, z date ) columns, there
    is no primary or unique key.
    I have been inserting values into it. there r some duplicate
    values to.
    but now I want to modify only the record inserted at the end.
    i.e
    if initially ABC is having
    x y z
    10 20 01-nov-2001
    11 20 01-nov-2001
    out of these records I want to change the value of x to 50 for
    the record which was inserted last or shall I say whose z is the
    greatest.
    I have been trying to do but what I see that the z column is not
    getting the time in increasing order. i.e even though I tried to
    display the dated in dd-mon-yyyy 24hh:mm:ss format still and I
    found that date is not consistant. the record I inserted first
    is have a much more value than the record I inserted last.
    please help...
    Sreekant

    rowid refers to the current position of the record; if the
    record has been moved (and there are any number of reasons why
    the database might shift a record) the order of rowid will not
    reflect the order of insertion.
    the only way to guarantee order of insertion is to timestamp the
    record. if I understand the original posting, you have been
    doing this.
    Now you should have been using SYSDATE. if you are saying that
    SYSDATE is giving you inconsistent results then you have a real
    problem: has somebody been tinkering with your database server -
    changing the system clock or something?
    Or are you using some other method to set the value for Z
    column? If so, what?
    rgds, APC

  • How to find the last refresh of database?

    Hi,
    Can someone tell me how to find when was the last refresh of a database was done.

    Now it is much better!!!
    1. If the cloning was done using a cold backup of
    database, how can we know when was the last cloning
    on testing db done.If the cloned database has been opened with RESETLOGS option, you can try checking out V$DATABASE.RESETLOGS_TIME. if the V$DATABASE.CREATED is not equal to V$DATABASE.RESETLOGS_TIME...there is a possibility that it might be opened with resetlogs option. I don't have the required set up to check and confirm this myself....but this is something you can get it a shot.
    2. If export/import utility is used for this purpose,
    the how can we find out the last time the testing db
    was 'refreshed'?If import was used, check the object creation timestamps of majority of them...may be it will help you find the required information.
    HTH
    Thanks
    Chandra Pabba

  • How to determine the last time  a database was used

    Is it possible in to determine the time a CRUD operation occurred on a database?

    How can I activate the auditing? http://download-east.oracle.com/docs/cd/B19306_01/network.102/b14266/auditing.htm#i1011984
    Daljit Singh

Maybe you are looking for