Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing Data

 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm using MSAccess and JSP.I like to store only few of data in the database, not all the data, but its not accessing, its asking for all the field values, Kindly give me the solution.(Ex: there are 10 fields, but i wanna store the data for only 7, rest of the data i will do it in another process)
[ May 29, 2004: Message edited by: Sri Gnana ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JDBC forum.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sri,
Are those fields that you don't want to set nullable? If so, specify the columns you want to set in the SQL statement:
insert into table (col1, col2, ...) values (value1, value2 ...)
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the SQL statement that you're using?
 
Sri Gnana
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help
Here my jsp file, I have already posted in JSP forum


Hi,
when i try to execute the code given below, its throwing compile time error
; expected, please help me
__________________________________

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


<html>
<Body bgcolor=silver>
<br>
<%



String s1=null,s2=null,s3=null,s4=null,s5=null,s6=null;
String sqltext;

s1=request.getParameter("txtName");
s2=request.getParameter("txtAdnno");
s3=request.getParameter("selClass");
s4=request.getParameter("selSec");
s5=request.getParameter("txtDate");
s6=request.getParameter("txtAdnfee");



if(s1 !=null)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc dbc:Adn","","");
Statement st=con.createStatement();


sqltext="insert into AllIn ("Name, Adnno, Class, Section, Date, Adnfee") values ('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"' )";


st.executeUpdate(sqltext);
out.println("Inserted Successfully!");

}
catch(Exception e)
{
System.out.println(e);
}
}
else
{
%>

your data could not be inserted
<A HREF=Admission.html> Click Here </A> to Try again !
<%
}
%>

</body>
</html>

In this I'm getting Error ; expected
[ May 31, 2004: Message edited by: Sri Gnana ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you get a line-number, where the ';' is expected?

Can you translate this number into the code-String, because linebreaks aren't allways threated identically, and line-numbers not printed.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah - I found the line!


The semicolon is expected here:

While you meant:

[ May 31, 2004: Message edited by: Stefan Wagner ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic