Display Autonumber from Access Database when click insert button

I have an application that displays all the customers in my Access database. The primary key is an Autonumber that Access generates.
How can I display the autonumber that Access generates when I click my insert new record button?

The generated autonumber can be retrieved with a SELECT @@IDENTITY which is the same syntax as in SQLServer. When this statement is executed it is effectively asking for the last 'identity' value seen on the current connection which will be the ID of the row you just created with your INSERT statement.

Similar Messages

  • Trying to display results from access database query on a JSP

    Seem to be having real difficulty with this one, i keep getting a null pointer exception :(. Wondered if anyone could point me to any examples of displaying the results on jsp. The database is connected, as i can display the query on netbeans, but just not on a jsp.

    I think it would be good if we had a section in these forums for pre-canned answers to the same questions that come up again and again. It would save time.
    Here is a rough outline for using JSP:
    * Read a JSP book.
    * The JSP page (View in MVC) should get all the data it needs to display from a useBean and/or request.getAttribute().
    * The JSP page should not have any business logic. Its purpose is to display data only (and have some submit buttons such as 'update').
    You can do some basic client side validation using javascript if you want. Because there is no business logic in it, you can easily debug
    your code in the servlet or business logic. You can't set breakpoints in JSP and examine data easily.
    * When you click the submit button, all data from <input type="text" tags, etc is put into request scope via name/value pairs.
    * Submit the JSP page <form tag to a servlet (Control in MVC).
    * The servlet reads the name/value pairs of data from the JSP page via request.getParameter()
    * The servlet should then instansiate a business object (Model in MVC), passing the data it got from the page to the business logic.
    Example: ProcessPage processPage();
    if(request.getParameter("updateButtonClicked"))
    processPage.updateData(data from the jsp page)
    * The business logic should instansiate a separate database object (DAO) to get data to/from the database. Business logic should not have sql in it.
    Business logic should not generate html. Business logic should not have request objects in it.
    * The business logic should return data to the servlet that in turn will put it in request scope via request.setAttribute() so the JSP page can draw itself.
    * The servlet should then call up the approprate JSP page.

  • Upload data from Access Database to Oracle Database In oracle 8i

    hi everybody
    i am trying upload data from Access database to Oracle Database
    i have TT(F1,F2,F3) table in Access Databsse
    and emp(ename,ecode,sal) in oracle Database
    db_ac is my datasource name
    when i connect to Access Database thru this command this show following error
    SQL> connect a/a@odbc:db_ac;
    ORA-00022: invalid session id; access denied
    ORA-00022: invalid session id; access denied
    ORA-00022: invalid session id; access denied
    Error accessing PRODUCT_USER_PROFILE
    Warning: Product user profile information not loaded!
    You may need to run PUPBLD.SQL as SYSTEM
    Server not available or version too low for this feature
    ORA-00022: invalid session id; access denied
    Connected.
    when i am trying copy data as this command it show error and data not copied.
    SQL> COPY FROM A/A@ODBC:DB_AC TO test/test@ora INSERT EMP USING SELECT F1,F2,F3 FROM TT;
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    ORA-00022: invalid session id; access denied
    ERROR:
    OCA-00022: general OCA error
    can help me .
    with thanx

    Hi there,<br>
    <br>
    Please kindly use instead the Database Forum at:-<br>
    General Database Discussions<br>
    <br>
    ... to place your question as this is for the Oracle Portal product Export / Import functionality.<br>
    <br>
    <br>
    Kind regards,<br>
    Pedro.

  • Not getting the records from Access database

    Hi All,
    Iam creating a universe based on Access database. I am able to view the data from all the tables except one table. When i try to view the data there is one error message "Syntax error in from clause, State: 37000". Everything is ok at database side. What does this error means?
    Please help me on this.
    Thanks.

    Hi BOCP,
           Thanks for your reply. I have resolved my issue. Actually my issue was, I have a table "Date" in universe which was created in Access database, when i tried to view the Date Table values in Universe i was getting that Syntax error in From clause message. I came to know that Date is a keyword or predefined table in WebI & it wont accept that word as a user defined Table. So i renamed that table in Access and Universe. Now my issue was solved.
    Thanks,
    Swati.

  • Get "Access Denied" when click open a PDF file

    Hi Friends,
    Get "Access Denied" when click open a PDF file linked from SharePoint 2013 page.
    What are the route causes any one is remove the permissions are stopped the inheritance permissions of the library.
    Can anyone face the same issue please help me.
    Thanks,
    Tiru
    tirupal

    Hi,
    If you are able to open the same document earlier,then  anonymous access enabled on your doc library then.
    If you are facing this problem in first time,then you do not have required permission (may be custom permission level has been set ) on it.
    Murugesa Pandian.,MCTS|App.Development|Configure

  • How to display the details of particular order when click on button in sapui5

    Hi Experts,
        How to display the details of particular order when click on button in sapui5?
    I Have a requirement that is i want display all the list of orders coming from backend as shown in image below
    then in that i have a button when i press the button  it need to display the details of particular order as shown in image below
    Please help me .
    Thanks & Regards
    chitti

    Does anyone know how to display the index of current desktop?
    Brute force - - I have written the number of the Desktop directly onto the wallpaper picture I am using for each Desktop  (easy to do with Preview).
    All Desktops are using different wallpaper photos, so they are easily recognized by the color scheme, and in the upper left corner is the number.
    Regards
    Léonie

  • Data access from Access Database

    I want collect some data from access, I have created a frame with swing componet, now when I am searching data with some variable from Access database , it is not comming, but in simple case all data are comming in differnt places in my frame.
    The string which I used is
    st.executeQuery("Select * from student where cid = '+st1+'"
    where st1 is avariable collected some data from the frame, it is tested ok.
    now i never did practice with access, please if there is any wrong .

    Could you include more code please? The single statement you have provided seems fine, but we're not psychic.

  • Walkthrough: Displaying Data from Oracle database in a Windows application.

    This article is intended to illustrate one of the most common business scenarios such as displaying data from Oracle database on a form in a Windows application using DataSet objects and .NET Framework Data Provider for Oracle.
    You can read more at http://www.c-sharpcorner.com/UploadFile/john_charles/WalkthroughDisplayingDataOracleWindowsapplication05242007142059PM/WalkthroughDisplayingDataOracleWindowsapplication.aspx
    Enjoy my article.

    hi,
    this is the code :
    public class TableBean {
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    public List getperInfoAll() {
    int i = 0;
    try
    con = DriverManager.getConnection("url","root","root");
    ps = con.createStatement();
    rs = ps.executeQuery("select * from user");
    while(rs.next()){
    System.out.println(rs.getString(1));
    perInfoAll.add(i,new perInfo(rs.getString(1),rs.getString(2),rs.getString(3)));
    i++;
    catch (Exception e)
    System.out.println("Error Data : " + e.getMessage());
    return perInfoAll;
    public class perInfo {
    String uname;
    String firstName;
    String lastName;
    public perInfo(String firstName,String lastName,String uname) {
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    public String getUname() {
    return uname;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    ADF table code:
    <af:table value="#{tableBean.perInfoAll}" var="row"
    binding="#{backing_Display.table1}" id="table1">
    <af:column sortable="false" headerText=""
    align="start">
    <af:outputText value="#{row.firstName"/>//---> Jdeveloper 11g doesn't allow me to use this.. it says firstName is an unknown property..
    </af:column>
    </af:table>
    Please tell me is this the way to do it.. or is it a must to use the DataCollection from the data controls panel...
    Thanks...

  • Javascript preferences error when clicking insert

    hi,
    i tried looking around on the net however no solution i could see for this.
    when i click insert in DW CS3 i get an error in "yy/scripts/preferences.js" error 3
    i cannot see that file in my program files, how can i resolve this?
    many thanks

    hi,
    i gave this a go however it did not resolve the issue. still error when clicking insert. only started happening past few days. cant think of what has happened to make it do it.
    any other suggestions?
    many thanks

  • Microsoft Expression Encoder 4 crashes when clicking Start button to begin live smooth streaming to a publishing point created in Windows Server 2012

    Microsoft Expression Encoder 4 crashes when clicking Start button to begin live smooth streaming to a publishing point created in Windows Server 2012, I've got the following error. Can anyone help me with this? Thanks in advance!
    Nombre del evento de problema:    CLR20r3
      Firma del problema 01:    encoder.exe
      Firma del problema 02:    4.0.4276.0
      Firma del problema 03:    4eafa0d7
      Firma del problema 04:    mscorlib
      Firma del problema 05:    4.0.30319.18408
      Firma del problema 06:    52310b91
      Firma del problema 07:    3e69
      Firma del problema 08:    0
      Firma del problema 09:    System.InvalidCastException
      Versión del sistema operativo:    6.2.9200.2.0.0.272.7
      Id. de configuración regional:    3082
      Información adicional 1:    5861
      Información adicional 2:    5861822e1919d7c014bbb064c64908b2
      Información adicional 3:    dac6
      Información adicional 4:    dac6c2650fa14dd558bd9f448e23afd1
    Lea nuestra declaración de privacidad en línea:
      http://go.microsoft.com/fwlink/?linkid=190175
    Si la declaración de privacidad en línea no está disponible, lea la declaración de privacidad sin conexión:
      C:\Windows\system32\es-ES\erofflps.txt

    2014-12-17 16:05:41  Msg 5170, Level 16, State 1, Server \\.\pipe\Microsoft##WID\tsql\query,  Line 2
    Cannot create file 'C:\Windows\WID\Data\SUSDB.mdf' because it already exists
    Looks like somebody forgot to remove the database from the last time WSUS was installed.
    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

  • How to hide a TextField when clicking another button

    Hello!
    I've been able to generate a TextField to appear when clicking a button, but when I click on another button, to display some more information, I still have the first TextField displayed.  I've had a look around, but not been able to find anything to help me with getting the first to disappear.  Can anyone provide any ideas for this?
    The code I'm using for displaying the TextField is:
    button10.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    var fl_TF:TextField;
    var fl_TextToDisplay:String = "Send disply to the right screen/projector";
    function fl_ClickToPosition(event:MouseEvent):void
    fl_TF = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.LEFT;
    fl_TF.background = true;
    fl_TF.border = true;
    fl_TF.x = 300;
    fl_TF.y = 100;
    fl_TF.text = fl_TextToDisplay;
    addChild(fl_TF);
    Many thanks in advance

    all your buttons should call the same function. 
    because each button probably triggers different text to be displayed, you can use an object or dictionary to associate the buttons and their text:
    // execute these two lines and your function once at the start of your app
    var dictionary:Dictionary=new Dictionary(true);
    var fl_TF:TextField;
    function fl_ClickToPosition(event:MouseEvent):void
    if(fl_TF&&fl_TF.parent){  /
    fl_TF.parent.removeChild(fl_TF);
    fl_TF=null
    fl_TF = new TextField();
    fl_TF.autoSize = TextFieldAutoSize.LEFT;
    fl_TF.background = true;
    fl_TF.border = true;
    fl_TF.x = 300;
    fl_TF.y = 100;
    fl_TF.text = dictionary[e.currentTarget];
    addChild(fl_TF);
    ////////// and for each button use something like:
    button10.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);
    dictionary[button10] = "Send disply to the right screen/projector";

  • How to switch to another page when clicking a button

    I have a main frame consits of many button.What I need to do when click
    a button,it switch to another page?
    Thanx....

    Try this, it should work.
    // not tested
    JButton linkButton = new JButton("<html><a href=\"http://forum.java.sun.com\">link to<br>forum</a></html>");

  • Display image from Finacle database

    Hi,
    We have a requirement from the client to fetch an image of a Contact from a separate external database i.e. in our case it’s the Finacle db. Image should not be stored in Siebel.
    When clicked on the button. A pop up should appear and display the image in separate window.
    Is it possible to implement?
    Can you please provide any doc for support?
    Thanks,
    Shaik

    You can create a calculated field and create some URL, like: "<A href=http://some.url.com/identifier='" + [Row Id] + "'' target=_blank></A>"

  • Trouble displaying results from a database call

    Hi Everyone,
    I have written a JSP page that sends and receives information to a MySQL database. It is not completely functional unfortunately. The first section of the page that is responsible for updating a database table works fine. However when I go to retrieve information from the same database table something is going astray.
    I feel that I am doing something wrong with regard to the ResultSet object. Please see the bottom of the code section below. Ultimately this code only displays beach_percent as Zero, no matter how many entries there are in the database table for the corresponding value of Beach & Sea Stamps.
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="java.sql.*" %>
    <%
         Connection connect = null;
         Statement state = null;
         ResultSet rs = null;
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         String password = "theOne";
         String url = "jdbc:mysql://localhost/survey_database";
         String user = "David";
         connect = DriverManager.getConnection(url, user, password);
         state = connect.createStatement();
         if(request.getParameter("radiobutton") != null)
              String enter_text = "insert into craft_survey values('";
              enter_text = enter_text.concat(request.getParameter("radiobutton"));
              enter_text = enter_text.concat("')");
              rs = state.executeQuery(enter_text);
         else
              pageContext.forward("craftSurvey.jsp");
         rs = state.executeQuery("SELECT stamp FROM craft_survey");
         int beach = 0;
         int bear = 0;
         int christmas = 0;
         int country = 0;
         int easter = 0;
         int faux = 0;
         int floral = 0;
         int heart = 0;
         int phrase = 0;
         int special = 0;
         int total = 0;
         while(rs.next())
              String type = rs.getString("stamp");
              if(type.equals("Beach & Sea Stamps"))
                   beach++;
                   total++;
              else
              if(type.equals("Bear & Cuddly Stamps"))
                   bear++;
                   total++;
              else
              if(type.equals("Christmas Stamps"))
                   christmas++;
                   total++;
              else
              if(type.equals("Country & Garden Stamps"))
                   country++;
                   total++;
              else
              if(type.equals("Easter Stamps"))
                   easter++;
                   total++;
              else
              if(type.equals("Faux Postage"))
                   faux++;
                   total++;
              else
              if(type.equals("Floral Stamps"))
                   floral++;
                   total++;
              else
              if(type.equals("Heart & Romance Stamps"))
                   heart++;
                   total++;
              else
              if(type.equals("Phrase & Wording Stamps"))
                   phrase++;
                   total++;
              else
              if(type.equals("Special Occasion Stamps"))
                   special++;
                   total++;
         int beach_percent = 0;
         int bear_percent = 0;
         int christmas_percent = 0;
         int country_percent = 0;
         int easter_percent = 0;
         int faux_percent = 0;
         int floral_percent = 0;
         int heart_percent = 0;
         int phrase_percent = 0;
         int special_percent = 0;
         if(beach > 0)
              beach_percent = (beach / total) * 100;
         if(bear > 0)
              bear_percent = (bear / total) * 100;
         if(christmas > 0)
              christmas_percent = (christmas / total) * 100;
         if(country > 0)
              country_percent = (country / total) * 100;
         if(easter > 0)
              easter_percent = (easter / total) * 100;
         if(faux > 0)
              faux_percent = (faux / total) * 100;
         if(floral > 0)
              floral_percent = (floral / total) * 100;
         if(heart > 0)
              heart_percent = (heart / total) * 100;
         if(phrase > 0)
              phrase_percent = (phrase / total) * 100;
         if(special > 0)
              special_percent = (special / total) * 100;
    %>
    <html>
    <head>
    <title> Craft Stamp Survey Results </title>
    </head>
    <body background="#ffffff">
    <h1> Craft Stamp Survey Results </h1>
    <table width="100%">
         <tr align="center">
         <td><img src="green_bar.jpg" height="20" width="<%=beach_percent *3%>"></td>
            <td>Beach & Sea Stamps</td>
            <td><%=beach_percent%></td>
    </tr>
    </table>
    </body>
    </html>Any help with getting this page to display anything other than zero will be great appreciated.
    Thanks
    David

    Hi,
    One reason could be of spaces .Before checking in the loop use trim function on the data retrieved from the database. You can also debug using System.out.println.
    Also just a suggestion - it is always a good coding practice to declare the variablse outside the loop. Don't declare the variables within a for loop.

  • CREATING A CODE WHICH GETS CONTENT FROM ACCESS DATABASE

    HI .I kindly ask you to help me to get a code in visual basic. The system keeps the START_DATE and END_DATE of several items in DataGridView of access databases . like if Start_date is today and end_ date
    is tomorrow but one,then If the end_date comes , should show a massage like "CONGZ!! TODAY IS YOUR BIRTHDAY". Thank u very much 
    [email protected]

    Hi Eustus Muhanguzi,
    for keeping your own privacy, please remove your email address from your message by clicking the "Edit" link above the message.
    I'm not sure if I understood your question correctly. Do you want to get this message at midnight at the transition from End_Date - 1 to End_Date?
    I suggest you add a Timer that ticks every second or every couple of seconds.  Whenever it ticks, compare DateTime.ToDay to End_Date.Date. You can do this in a loop processing all rows from the DataGridView (DGV). If the End_Date is reached, you have
    to remember that for this row the day has already been recognized as the birthday. You can do this in the same row or by keeping another List. After that, call MessageBox.Show to display the message.
    Please let us know if the DGV is data bound or unbound.
    It is not clear what happens if the program is not always running. If it is started at End_Date, midnight has already been passed.
    I do not see which role the Start_date plays in this comparison.
    Armin

Maybe you are looking for