hello every one,
i m trying to insert data from jsp page to database using sql insert query. every thing is working fine but when i m using autonumber in database(Ms Access) it is showing error.
so please help me how to do it??/

Exclude autonumber column from the list. I presume that the table TestTable has three columns; ID,Name,Age where column ID is autonumbered.

String sql="insert into TestTable (Name,Age) values ('A',20)";

hi,
i had done the same but it is showing the error like "the passed parameter and desination is not same...no. of columns and values not matching".

Then there may be something wrong with your BD table as that query is just fine. Check this for example

>the passed parameter and desination is not same...no. of columns and values not matching.
You need to post the query.

hello,
i have gone through this site.
i m trying to use ms-access as DB. i have done the same as it is given in that, but still it showing the same error.

i have written query like this: where registrationno is auto number.

[String s0 = request.getParameter("registrationno");
String s1 = request.getParameter("firstname");
String s2 = request.getParameter("middlename");
String s3 = request.getParameter("lastname");
String s4 = request.getParameter("designation");
String s22 = request.getParameter("dateofbirth");
String s5 = request.getParameter("usertype");
String s6 = request.getParameter("username");
String s7 = request.getParameter("password");
String s8 = request.getParameter("retypepassword");
String s9 = request.getParameter("gender");
String s10 = request.getParameter("addresstemp");
String s11 = request.getParameter("addresspermanent");
String s12 = request.getParameter("city");
String s13 = request.getParameter("state");
String s14 = request.getParameter("country");
String s15 = request.getParameter("zipcode");
String s16 = request.getParameter("mobileno");
String s17 = request.getParameter("landlineno");
String s18 = request.getParameter("faxno");
String s19 = request.getParameter("secondary_emailid");
String s20 = request.getParameter("securityquestion");
String s21 = request.getParameter("securityanswer");
String str11= ("Select * From registration1");
String str1 = ("INSERT INTO registration1 VALUES('"+s0+"','"
+s1+"','"
+s2+"','"
+s3+"','"
+s4+"','"
+s22+"','"
+s5+"','"
+s6+"','"
+s7+"','"
+s8+"','"
+s9+"','"
+s10+"','"
+s11+"','"
+s12+"','"
+s13+"','"
+s14+"','"
+s15+"','"
+s16+"','"
+s17+"','"
+s18+"','"
+s19+"','"
+s20+"','"
+s21+"')");

You are missing the column names.
See adatapost's post giving an example of the insert statement.

Your statement should look something like this:

INSERT INTO registration1 (registrationno, firstname,.....) VALUES('"+s0+"','"+s1+"'....)

i have done the same but it is showing the same error....
is there any thing in insert query to add something like for autonumber???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.