Results 1 to 7 of 7
  1. #1
    Vinay Bhatia is offline Member
    Join Date
    Oct 2010
    Posts
    5
    Rep Power
    0

    Question how to insert data in database

    Hi friends, i m making a gui application in which there is an insert button, and some textboxes, now i want as soon as i click on the insert button, all the data of the textboxes should be saved in my database. i am using Ms-access for database..
    I will be thankful to you
    plss give me the code.. plsss
    Thanks...


    Vinay

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Vinay Bhatia View Post
    ...plss give me the code.. plsss
    Sorry, this is not a "give me the code" type of site. If that's all you need, then go to rent a coder . com and pay for it. Most of what you are asking for can be found by doing a Google search and studying a few tutorials. If after you've done this, you're still stuck, then by all means, show us your code and tell us your problem, but just don't ask for code and not show us what work you've done.

    Luck.
    Last edited by Fubarable; 10-20-2010 at 07:17 PM.

  3. #3
    Vinay Bhatia is offline Member
    Join Date
    Oct 2010
    Posts
    5
    Rep Power
    0

    Default

    Hi this is the code, by which i have fetched data from my database, now i want to insert data in database, i know the query "insert into value(.....)" but how to do that plsss let me know. Thank you very much...


    import java.sql.*;
    /**
    * The application's main frame.
    */
    public class StudentinformationView extends FrameView {

    public StudentinformationView(SingleFrameApplication app) {
    super(app);

    initComponents();
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection cn=DriverManager.getConnection("jdbc:odbc:student" );
    Statement st=cn.createStatement();
    ResultSet rs=st.executeQuery("select*from std_info");
    while(rs.next())
    {
    System.out.println(rs.getString("s_name")+""+rs.ge tString("s_address")+""+rs.getString("s_rollno")+" "+rs.getString("s_contactno"));
    }
    cn.close();
    }
    catch(Exception ex)
    {
    System.out.println("error"+ex.getMessage());

    }

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default

    Your question has everything to do with databases and nothing to do with AWT / Swing. So why did you post it here?

    db

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  6. #6
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by Vinay Bhatia View Post
    Hi this is the code, by which i have fetched data from my database, now i want to insert data in database, i know the query "insert into value(.....)" but how to do that plsss let me know.

    in this forum you will find a lot of tutorials and one of them is about java database connectivity. here is the link and what you are looking for is in the section "Adding records in the database tables".

  7. #7
    Vinay Bhatia is offline Member
    Join Date
    Oct 2010
    Posts
    5
    Rep Power
    0

    Smile Thank you.

    Hi brother, thanks. It is really very helpful for me. I will always thankful to you.
    again thank you very very much..

Similar Threads

  1. why i can't insert data to database
    By khaa_khay in forum Web Frameworks
    Replies: 0
    Last Post: 05-26-2010, 05:37 AM
  2. java insert data into database problem
    By chyeeqi in forum NetBeans
    Replies: 3
    Last Post: 03-29-2010, 01:36 AM
  3. Replies: 3
    Last Post: 03-19-2010, 12:59 AM
  4. Replies: 3
    Last Post: 02-28-2009, 09:17 AM
  5. Replies: 0
    Last Post: 02-10-2008, 11:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •