Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2005, 09:36 PM
Registered User
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ways to implment data maintenace in jsp

Dear All,

Can anyone tell me what is the ways of implementing the following operations:

Allow user to insert new row from jsp to database.
Database Table has 5 columns
User is able insert a blank row by pressing the button "Add Row", type in the data, and press the button "Save" to save all data to the database.

Thanks

 
Old January 4th, 2006, 06:28 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

if u want to insert the blank row then u can set that field alone "allow nulls" in database.suppose u want to add new row in your database...u can use the following code...

<%
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      Connection cn=DriverManager.getConnection("jdbc:odbc:democms" ,"sa","sa");
      Statement st=cn.createStatement();
      String str1,str2;
      str1=request.getParameter("namet2");
       str2=request.getParameter("desigt3");
       String query = "insert into democms1 values('"+str1+"','"+str2+"')";
       int rs=st.executeUpdate(query);
       if(rs!= 0)
        {
             out.println("Entry successfully Inserted");
        }
        else
        {
            out.println("Error! Please try again.");
        }
       st.close();
       cn.close();
    %>

its working..so try this one..
i dont know whether i am getting your question or not.....for my understanding, i am sending this...am i right?







Similar Threads
Thread Thread Starter Forum Replies Last Post
The different ways to assgn an event handler cris9 Javascript 0 February 25th, 2007 09:32 AM
What r different ways of knowing values in Object? [email protected] VB.NET 2002/2003 Basics 1 September 27th, 2006 02:48 PM
different ways of interfacing with MS Office chandler7272 C# 3 July 21st, 2006 03:52 PM
What are different ways to deploy VB on client mac Konan Beginning VB 6 0 July 10th, 2006 04:04 AM
different ways to login to a remote server phpsharma Linux 2 January 30th, 2004 07:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.