If u don't wanna give values for all the fields then u need to specify
columns also
like
sql ="INSERT INTO test COLUMNS(COL1,COL2) VALUES(?,?)";
rest of the columns will be initialised with default vaues as set in the db
otherwise with null(but for this these columns should be nullable).
Regards,
Niraj Nath,
IBM Global Services India Ltd.,
Bangalore - 560 001.
Ph. No. 91-80-2244056, Ext. 213
Venu Gopal <[EMAIL PROTECTED]> on 11/11/2000 01:05:33 PM
Please respond to A mailing list about Java Server Pages specification and
reference <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Niraj Nath/India/IBM)
Subject: Re: prepared statement problem
The skipped field should NOT be the PRIMARY KEY..
Venu
--- Mutahar Qayum <[EMAIL PROTECTED]> wrote:
> Actually you can even specify what columns you are
> inserting.
> like.
> sql ="INSERT INTO test(userid,username)
> VALUES(?,?)";
>
> regards
> -----Original Message-----
> From: Synu Jacob Vengal
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 07, 2000 9:03 PM
> To: [EMAIL PROTECTED]
> Subject: prepared statement problem
>
>
> > > Hi,
> > > I am using a prepared statement to insert values
> into the database
> > fields.
> > > Is it always necessary that we should insert
> data in all the fields or
> > else null values??
> > > for eg. i gave the sql as
> > > sql ="INSERT INTO test VALUES(?,?)";
> > > when the actual table contained 3 fields.
> > > When i skipped one field it shows the following
> error
> > > java.sql.SQLException: [Microsoft][ODBC Driver
> Manager] Invalid argument
> > value
> > > Pls give me a solution.
> > > Thanks ,
> > > SJ
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets