Solved

JDBC: ADD Data

Posted on 2004-10-24
181 Views
Last Modified: 2010-03-31
Hey all,
I can setup a JDBC connection, and retrieve data (using "SELECT ..."). However, I'm not too sure on how to ADD data.

I have connected to a Microsoft Access Database. The TABLE is called "UserNotes". Which has the following headers:

StudentID          Username          Password          Notes
(AutoNumber)

How do I then ADD a Username, Password and Notes??

Thanks alot! :D
[r.D]
0
Question by:DrWarezz
    2 Comments
     
    LVL 8

    Accepted Solution

    by:
    Hi DrWarezz,

    Assuming you already have a JDBC connection named conn (from your select statment):


    Statement stmt = conn.createStatement();
    stmt.executeUpdate("insert into UserNotes (Username, Password, Notes) values ('DrWarezz', 'secretpassword','DW is da man') ");


    Good luck!
    0
     
    LVL 9

    Author Comment

    by:DrWarezz
    :D Excellent -- thanks alot Signmacon.

    [r.D]
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Learn The Basics of Ethical Hacking & Pen Testing

    Computer and network security is one of the fastest growing and most essential industries in technology, meaning companies will pay big bucks for ethical hackers. This is the perfect course to leap into this lucrative career, learning how to use ethical hacking to reveal ...

    Suggested Solutions

    Title # Comments Views Activity
    MaxSpan challenge 9 34
    java constructor error 8 45
    java continue statement 10 32
    ArrayLists in ArrayLists/HashMaps? 4 7
    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now