Thanks

Thanks

View Answers

September 11, 2008 at 12:48 PM

Hi friend,

Form for prod_master table "prod.jsp"


<%@ page import="java.sql.*" %>
<html>
<head>

</head>
<body>
<form name="prodForm" action="prodadd.jsp">
<br><br>
<table border="0" width="400px" align="center" bgcolor="#CDFFFF">
<div id="mydiv"></div>
<tr><td><b>Select Vender</b></td><td>
<select name="vend_id">
<option value="-1">Select</option>
<%



Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "vender";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";

int sumcount=0;
Statement st;
try {
Class.forName(driver).newInstance();

conn = DriverManager.getConnection(url+dbName,userName,password);
String query = "select * from vend_master";

st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
%>

<%
while(rs.next())
{
%>

<option value="<%=rs.getInt(1)%>"><%=rs.getString(2)%></option>

<%
}
%>

<%

}
catch (Exception e) {
e.printStackTrace();
}

%>

</select>
</td></tr>


<tr><td ><b>Product Name:</b></td><td><input type="text" name="prod_name" id="prod_name" value=""></td></tr>
<tr><td><b>Recorder Level:</b></td><td><input type="text" name="reorder_level" id="reorder_level" value=""></td></tr>
<tr><td ><b>Recorder Quantity:</b></td><td><input type="text" name="reorder_qty" id="reorder_qty" value=""></td></tr>
<tr><td>&nbsp;</td><td><input type="Submit" name="submit" value="Save"></td></tr>

</table>
</form>

<table border="0" width="100%" align="center">


<br>
<br>


</table>
</body>
</html>

September 11, 2008 at 12:50 PM

Insert the record in prod_master table

<%@ page import="java.sql.*,java.util.*" %>
<%
int vend_id=0;

if(request.getparameter("vend_id")!=null && request.getparameter("vend_id"))
{
vend_id = Integer.parseInt(request.getparameter("vend_id").toString());
}

String userName = request.getParameter("userName");
String password = request.getParameter("password");

System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "user_register";
String driver = "com.mysql.jdbc.Driver";
String username = "root";
String userPassword = "root";



try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,username,userPassword);
Statement st = conn.createStatement();

String queryString = "INSERT INTO product_master set prod_id="+prod_id+",prod_name='"+prod_name+"',reorder_level="+reorder_level+",reorder_qty="+reorder_qty+",vend_id="+vend_id;
int i = st.executeUpdate(queryString);

if(i>0)
{
response.sendRedirect("welcome.jsp");
}



conn.close();

} catch (Exception e) {
e.printStackTrace();
}
%>

For read more information and details to visit :

http://www.roseindia.net/

Thanks









Related Tutorials/Questions & Answers:
Thanks
Thanks  This is my code.Also I need code for adding the information on the grid and the details must be inserted in the database. Thanks in advance
thanks - JSP-Servlet
thanks   thanks sir i am getting an output...Once again thanks for help
Advertisements
ModuleNotFoundError: No module named 'no-thanks'
ModuleNotFoundError: No module named 'no-thanks'  Hi, My Python... 'no-thanks' How to remove the ModuleNotFoundError: No module named 'no-thanks' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'thanks'
ModuleNotFoundError: No module named 'thanks'  Hi, My Python... 'thanks' How to remove the ModuleNotFoundError: No module named 'thanks' error? Thanks   Hi, In your python environment you have
thanks - JSP-Servlet
thanks  thanks sir its working
Thanks - Java Beginners
Thanks  Hi, Thanks for reply I m solve this problem   Hi ragini, Thanks for visiting roseindia.net site
Thanks to Amardeep - Java Beginners
Thanks to Amardeep  i don't know how to thank you Amar! i real thank for what you did' i mean what you did is really my pressure, thanks.... thanks Amardeep. 2hafeni
Thanks to Amardeep - Java Beginners
Thanks to Amardeep  i don't know how to thank you Amar! i real thank for what you did' i mean what you did is really my pressure, thanks.... thanks Amardeep. 2hafeni
Thanks - Java Beginners
Thanks  Hi, Yur msg box coding is good Thanks  Hi Thanks & Regards
Thanks - Java Beginners
Thanks  Hi, thanks This is good ok this is write code but i... either same page or other page. once again thanks    hai... the problem... state it correctly.... thanks and regards prashu
thanks - Development process
thanks  thanks for sending code for connecting jsp with mysql. I have completed j2se(servlet,jsp and struts). I didn't get job then i have learnt.... please help me. thanks in advance
Thanks - Java Beginners
Thanks  Thanks Deepak Thankyou so much this is good web application but i m clicking insert button then addform.jsp page is not open plz suggest me   hai friend I think u gave the url is not currect. Check
Thanks - Java Beginners
Thanks  Hi, Thanks ur sending url is correct..And fullfill requirement.. I want this.. I have two master table and form vendor... and send me... Thanks once again...for sending scjp link
Thanks - Java Beginners
Thanks  Hi Rajnikant, Thanks for reply..... I am... is the advantage of interface and what is the use of interface... Thanks... and analyze you got good scenario about Interface Thanks Rajanikant   Hi
Thanks - Java Beginners
Thanks  Hi, Thanks ur sending url is correct..And fullfill... and send me... Thanks once again...for sending scjp link  Hi friend... to visit : http://www.roseindia.net/ Thanks
ModuleNotFoundError: No module named 'witness_thanks'
ModuleNotFoundError: No module named 'witness_thanks'  Hi, My... named 'witness_thanks' How to remove the ModuleNotFoundError: No module named 'witness_thanks' error? Thanks   Hi, In your python
Hi and Thanks for ur response - Hibernate
Hi and Thanks for ur response  Hi, thanks for ur immediate response.Could anyone know abt the elements generated by generic DAO classes and pls let me know what is persistenceInstance with one good example. pls explain me
Thanks for fast reply - Java Beginners
Thanks for fast reply  Thanks for response I am already use html for data grid but i m noot understood how to connect to the data base, and how to fetch data from table in the data grid I am using mysql database package
Please help need quick!!! Thanks
(); ^ 6 errors any help would be appreciated guys. Thanks so
ModuleNotFoundError: No module named 'odoo10-addon-donation-thanks'
ModuleNotFoundError: No module named 'odoo10-addon-donation-thanks'  ...: No module named 'odoo10-addon-donation-thanks' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-donation-thanks' error
ModuleNotFoundError: No module named 'odoo8-addon-donation-thanks'
ModuleNotFoundError: No module named 'odoo8-addon-donation-thanks'  ...: No module named 'odoo8-addon-donation-thanks' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-donation-thanks' error? Thanks
Answer me ASAP, Thanks, very important
Answer me ASAP, Thanks, very important  Sir, how to fix this problem in mysql i have an error of "Too many connections" message from Mysql server,, ASAP please...Thanks in Advance
thanks - Java Beginners
thanks deepak for guiding me to draw graphs using org.jfree - Java Beginners
thanks deepak for guiding me to draw graphs using org.jfree  Hi deepak, thanks deepak....... i got the graphs using org.jfree.......... as u said, i set the class path............ thanks mate
Need help in completing a complex program; Thanks a lot for your help
Need help in completing a complex program; Thanks a lot for your help  Hi, I am currently working on one program which works in this way. 1... it? Thanks a ton for your help
Begineer Help Help Please Thanks A million ) I am using Jcreator
Begineer Help Help Please Thanks A million ) I am using Jcreator  System.out.println(" Income Statement"); System.out.print("Year
Introduction to ANT
Introduction to ANT         Initially, it was not an easy task to work on the large java projects but thanks to ant for simplifying the complex details apart from
Instant Messaging Applications ? Connect Wherever You Are
Instant Messaging Applications – Connect Wherever You Are There are more ways to communicate today than ever before and this is thanks largely to the advancements in technology. First there were telephones, then mobile phones
Goa Tourism Information
in the western India has become a honeymooners hub over the years; thanks
What is software as a service(SaaS)?
These days the abbreviation SaaS is incredibly popular among tech wizards thanks the huge possibility that the attributes of this term offer. SaaS stands for software as a service, means typical software application that is being
Top 10 Web Development Skills
internet access patterns and uses thanks to the all encompassing proliferation... regained its prominent as the deciding factor in the search ranks thanks to array... and mobile application based internet access thanks to mobile interface on sleazy
Money Transfer Applications ? Making Your Life That Much Easier
decade the industry has undergone an astounding amount of advancements thanks
Top 10 Cloud Applications for Students
from anywhere and from any device thanks to cloud based server backup. Among
Top 10 Emerging Social Networking Sites
message board for real time sharing. Thanks to this sleazy platform, team based
Best Cloud Computing Applications for Small Business
Cloud computing for some years has almost become the buzzword that given the widespread publicity it received thanks to numerous hand-held computing devices and upsurge of applications seems almost a unstoppable force which is going
PHP invoke Method
How to Encrypt Your Cloud Storage?
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
javascript - Design concepts & design patterns
javascript  Need JavaScript Examples. Thanks
HTML5
HTML5  Hi, What is HTML5? Thanks
What is Hibernate
What is Hibernate  Hi, What is Hibernate? Thanks
JVM - Java Beginners
JVM  Hi, Is JVM a compiler or an interpreter? Thanks   Hi Friend, JVM is an interpreter. Thanks
UITabbar height
UITabbar height  Hi, What is the height of UITabbar? Thanks   Hi, Size of UITabBar is 320x49. Thanks
JFreechart & JCommon
JFreechart & JCommon   hi........... thanks a lot. The code is running successfully and able to get the output. Thanks once again
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
install dplyr in r
install dplyr in r  Hi, How to install dplyr in r? Thanks
optimize sql query
optimize sql query  How to optimize sql query in mysql? Thanks
detect tap on uiimageview
detect tap on uiimageview  detect tap on uiimageview UIScrollView. Thanks

Ads