• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

code for modification

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kindly explain me with a sample code as to how to modify a record..
I have shown in a jsp page the records inserted by the user..and next to that there is a modify link to modify that particular record.
The next page will show the values of that particular record and modify them.
I have an identity column in the table where records are inserted.
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rather than expecting someone else to provide your code for you, how about giving it a try yourself and then posting with the portions that you are having problems with?
Please refer to this topic.
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
very right!!
here is my code for updation..
there is a browse page..which has links at the end of each record..to modify..
like <a href="modify_teaching_load.jsp"?selected_Id="<%=ob.getLoad_id()%>" >Modify</a>
load_id is the identity column of my table..
and in modify page the code is like this:
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc dbc:mech_iit");
stmt=con.createStatement();
String selected_Id="";
semester=request.getParameter("semester");
course=request.getParameter("course");
course_no=request.getParameter("course_no");
course_title=request.getParameter("course_title");
selected_Id=request.getParameter("selected_Id");
if(request.getParameter("Update")!=null)// if this page is called after hiting submit button.
{
stmt.executeUpdate("update teaching_load set semester='"+semester+"',course='"+course+"',course_no='"+course_no+"',course_title='"+course_title+"'");
%>
<jsp:forward page="teaching_load_modified.jsp?RecordCount=5"/>

<%
}
//this part will be executed..if this page is not called after hiting submit.
out.println("select semester, course, course_no, course_title from teaching_load where load_id in("+selected_Id+") ");
rs=stmt.executeQuery("select semester, course, course_no, course_title from teaching_load where load_id in("+selected_Id+") ");
if(rs.next())
{
semester=rs.getString("semester");
course=rs.getString("course");
course_no=rs.getString("course_no");
course_title=rs.getString("course_title");
}
}

catch(Exception ie)
{
System.out.println("ie");
}
%>
bt on the next page..all the values are gettign displayed as null..
 
I'm still in control here. LOOK at this tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic