![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
How can enter / Handle Default value and Auto increment fields on MYSQLI Am using MYSQL,
Database Created using this SQL COmmand Code:
While entering on Java PreparedStatement I Gave the Values Like this JAVA Code:
How Can I assign the values, It gives the error as follows Quote:
Here My Target is, 1. I want to set Access_No automatically one added plus one with previous number 2. I want to automatically add 1 on the available field Please help on that |
|||
|
#2
|
||||
|
||||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLThat is an improper SQL insertion statement.
The 'insert' command should look something like this: Code:
The insert for that table really only needs: (as Availabilitty also defaults to 1) Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLSmall Correction on the above posts,
Access_No field is Auto incremented field 2. I want to automatically add 1 on the availablitty field (Which is boolean Type) Please help on that, I need to increamented each new copies entering auto matically, While that time The Access number will want to increase Normally We can Use PreparedStatement to that But, stmt.setInt(1,-----) ??? How can I call this??? Regards, |
|
#4
|
||||
|
||||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLDouble check post #2, I added a little more info.
Note that in MySQL, 'boolean' actually resolves [gets converted] to type 'tinyint'. MySQL calls it a 'synonym', as shown here. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
|||
|
|||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLI checked now and used the statement without assigning the auto incremented and default value field, But It gives the following error
Quote:
|
|
#6
|
||||
|
||||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLSo what are your parameter values?
Here's my interaction: Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! Last edited by TurboPT : 10-Mar-2008 at 11:30.
|
|
#7
|
|||
|
|||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLTurbo
This is my method to inserting the Copies Inserting method JAVA Code:
That my previous posts has the database creating structure, Only I need to add following three data to the copies Table But I will use the loop for entering the copies, in that case Access_No -------------- integer Autoincrement isbn ----------------- String Availability ---------------- only take two values 0/1 But Above Code Giving error while executing the above method |
|
#8
|
||||
|
||||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLQuote:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#9
|
|||
|
|||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLRelace the inserting [3] with Ins_Copy
String Ins_Copy = "Copies (Access_No,ISBN,Availabilitty),VALUES (?,?,?)"; |
|
#10
|
||||
|
||||
Re: How can enter / Handle Default value and Auto increment fields on MYSQLAs I said in post #2, that is invalid SQL to do an INSERT. Revisit post #2 please.
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
Recent GIDBlog
New Corolla Altis, 10th Generation - Part I by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The