multivalued attribute

multivalued attribute

I have a author as multivalued attribute and i have inserted values for it in database but now how to insert values in the database through form .I have written query as shown below and iam getting error .

String query4="INSERT INTO author_det(accno,isbn,author) VALUES ('"+accno+"','"+isbn+"','"+author+"')"; stmt.executeUpdate(query4);

View Answers

March 4, 2011 at 12:37 PM

Jsp insert data into database

1)form.jsp:

<html>
<form method="post" action="insertdata.jsp">
<table>
<tr><td>Enter Acc No:</td><td><input type="text" name="accno"></td></tr>
<tr><td>Enter ISBN:</td><td><input type="text" name="isbn"></td></tr>
<tr><td>Enter Author:</td><td><input type="text" name="author"></td></tr>
<tr><td></td><td><input type="submit" value="submit"></td></tr>
</table>
</form>
</html>

2)insertdata.jsp:

<%@page import="java.sql.*,java.util.*"%>
<%
int ano=Integer.parseInt(request.getParameter("accno"));
int isbn=Integer.parseInt(request.getParameter("isbn"));
String name=request.getParameter("author");
ArrayList list=new ArrayList();
        try{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
        Statement st=con.createStatement();
        int i=st.executeUpdate("insert into author_det(accno, isbn,author) values("+ano+","+isbn+",'"+name+"')");
        con.close();
        out.println("Data is successfully inserted into database.");
        }
        catch(Exception e){
        System.out.println(e);
        }
        %>

3)table author_det:

CREATE TABLE `author_det` (                              
              `id` bigint(255) NOT NULL auto_increment,              
              `accno` int(255) default NULL,                         
              `isbn` int(255) default NULL,                          
              `author` varchar(255) default NULL,                    
              PRIMARY KEY  (`id`)                                    
            );

Ads









Related Tutorials/Questions & Answers:
multivalued attribute
multivalued attribute  I have a author as multivalued attribute and i have inserted values for it in database but now how to insert values in the database through form .I have written query as shown below and iam getting error
multivalued attribute?
multivalued attribute?  I have a problem in editing the database through form because of multivalued attribute it is creating the error and also how to write code for displaying the data when there is multivalued attribute
Advertisements
multivalued attribute?
multivalued attribute?  I have a problem in editing the database through form because of multivalued attribute it is creating the error and also how to write code for displaying the data when there is multivalued attribute
ModuleNotFoundError: No module named 'multivalued-dict'
ModuleNotFoundError: No module named 'multivalued-dict'  Hi, My... named 'multivalued-dict' How to remove the ModuleNotFoundError: No module named 'multivalued-dict' error? Thanks   Hi, In your
jsf attribute
jsf attribute  What is the different between value and binding attribute of jsf
What is attribute oriented programming?
What is attribute oriented programming?  Hi, What is attribute oriented programming? Thanks
MySQL Attribute
MySQL Attribute This example illustrates how to use the COLLATE attribute in MySQL. In this example we use the COLLATE attribute to define the attribute... and collation for the column. Query CREATE TABLE atttribute (attribute_name CHAR
Use of immediate attribute
Use of immediate attribute  What is the use of immediate attribute
JSF Rendered Attribute
JSF Rendered Attribute  i need the example for jsf with rendered attribute
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute of jsf tag
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute in jsf
isErrorPage attribute in the page directive
isErrorPage attribute in the page directive  How use isErrorPage attribute in the page directive ?   isErrorPage attribute is used... attribute is used to specify whether or not a JSP page displays an error page
How to use contentType Attribute in JSP?
How to use contentType Attribute in JSP?  Hi, I am learning JSP and now trying to use the contentType Attribute in JSP. tell me how to use the contentType Attribute in JSP? Thanks
retrieve multiple attribute values
XML retrieve multiple attribute values  Hello All Am a beginner. Would like some help with this. The following is part of my XML file: <...; What I would like is to retrieve both the attribute values of process
retrieve multiple attribute values
retrieve multiple attribute values  Hello All Am a beginner. Would like some help with this. The following is part of my XML file: <process... like is to retrieve both the attribute values of process:Output during execution
retrieve multiple attribute values
retrieve multiple attribute values  Hello All Am a beginner. Would like some help with this. The following is part of my XML file: <process... like is to retrieve both the attribute values of process:Output during execution
ModuleNotFoundError: No module named 'attribute-mapping'
ModuleNotFoundError: No module named 'attribute-mapping'  Hi, My... named 'attribute-mapping' How to remove the ModuleNotFoundError: No module named 'attribute-mapping' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'attribute_tree'
ModuleNotFoundError: No module named 'attribute_tree'  Hi, My... named 'attribute_tree' How to remove the ModuleNotFoundError: No module named 'attribute_tree' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'attribute_wrapper'
ModuleNotFoundError: No module named 'attribute_wrapper'  Hi, My... named 'attribute_wrapper' How to remove the ModuleNotFoundError: No module named 'attribute_wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'attribute_wrapper'
ModuleNotFoundError: No module named 'attribute_wrapper'  Hi, My... named 'attribute_wrapper' How to remove the ModuleNotFoundError: No module named 'attribute_wrapper' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'attribute-dict'
ModuleNotFoundError: No module named 'attribute-dict'  Hi, My... named 'attribute-dict' How to remove the ModuleNotFoundError: No module named 'attribute-dict' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'attribute-mapping'
ModuleNotFoundError: No module named 'attribute-mapping'  Hi, My... named 'attribute-mapping' How to remove the ModuleNotFoundError: No module named 'attribute-mapping' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'attribute_tree'
ModuleNotFoundError: No module named 'attribute_tree'  Hi, My... named 'attribute_tree' How to remove the ModuleNotFoundError: No module named 'attribute_tree' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'attribute_wrapper'
ModuleNotFoundError: No module named 'attribute_wrapper'  Hi, My... named 'attribute_wrapper' How to remove the ModuleNotFoundError: No module named 'attribute_wrapper' error? Thanks   Hi, In your
Version of nanning>nanning-attribute dependency
List of Version of nanning>nanning-attribute dependency
Page Directive attribute - language
Page Directive attribute - language This section contains description of language attribute of page Directive. language Attribute : The language attribute is one of attribute of page directive. Its functionality to specify
Page Directive attribute - isThreadSafe
Page Directive attribute - isThreadSafe This tutorial  contains description of isThreadSafe attribute of page Directive. isThreadSafe Attribute : isThreadSafe attribute is one of attribute of page directives. It is used
Page Directive attribute - pageEncoding
Page Directive attribute - pageEncoding This tutorial contains description of pageEncoding attribute of page Directive. pageEncoding Attribute : Page directive provides pageEncoding attribute to specify the language that the page uses
The info Attribute of page Directive In JSP
The info Attribute of page Directive In JSP  ... about the info attribute of the page directive in JSP. This attribute simply... Servlet.getServletInfo() method. The value of the attribute will be a text string. Here
Page Directive attribute - buffer
Page Directive attribute - buffer This section contains description of buffer attribute of page Directive. buffer Attribute : This attribute is used for specifying the buffer size for the output stream. Buffer size is specified
Page Directive attribute - extends
Page Directive attribute - extends This tutorial  contains description of extends attribute of page Directive. extends Attribute : This attribute specifies the super class of the JSP page's implementation servlet. It allows

Ads