Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error at Execute Update

 
Lilyana Saputra
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have some problem...
i create application to select, insert, update, delete database...

before when i create...it is work..either execute select, insert, update, delete
but now, when i try to check it...

select, delete - is working
insert, update - not working

i have been print the command and run it in EMS SQL, it is work, but in application, it is not work...

TO Connect:








TO INSERT: alway not null




TO UPDATE: it always return -1




thx
 
Madhav Manish
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've read your insert statements and from tehre itself ive seen your error!

in the insert, update,delete,select statement, you must always have a single quote for you values. eg.

statement.executeUpdate("update database.table set fieldname1 ='"+value1+"', fieldname2 ='"+value2+"', ... where keyname1 ='"+keyvalue+"'")
 
Lilyana Saputra
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx...
but it doesn't work...

is it that single quote, just only used for field's type varchar or date and time at mysql (i use mysql, and EMS)....

pls, help me...
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lilyana,
You are correct that the single quote is only needed for character or time based fields.

Did you check that the values you are adding to the SQL don't have any special characters?
 
Lilyana Saputra
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sory.. i think i am wrong...
i have been known what is wrong...

1. when i do some double check (insert mode)... i do some select and i check it, if (rs==null), data will be inserted... if not it will show a message...
but, the application always said that rs always not null... so, data message always appear and data cannot inserted...
so, i try another way , i check with count the row...if (row==0), data will be inserted.. but it is very strange because any select is working with null...

2. insert and update it work... but it always return -1...how can i know that it work or not??? or has effect or not??

thx
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic