• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help with insert values into access

 
Almog mar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help with this code:







I try to insert value into table in access but i dont succed...
I using with Eclipse.

You can fix my code for me?
I click on the botton NEXT and its no add the Name into the access...
Its add frame0.


Thanks you.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a bug in the jdbc-odbc bridge. Try running a select on the same connection then see if the insert went through.
 
Almog mar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David O'Meara wrote:There is a bug in the jdbc-odbc bridge. Try running a select on the same connection then see if the insert went through.



I dont understand...
This code: String sql="INSERT INTO RECIPESTABLE(RECIPENAME,INGREDIENTS)"+"VALUES('"+ fristName + "','Ingredients')"; is insert value
all work good the Eclipse run it....

If I change the code like that:"INSERT INTO RECIPESTABLE(RECIPENAME,INGREDIENTS)"+"VALUES('Pizza ','Ingredients')"; is insert value pizza and I want when you Enter your name it insert your name
and i dont know how to change this code for that this will run.

Now when I run it the Output is:
Like this:

1 Any Recipe
2 frame0
3 frame0
4 frame0
5 frame0
6 null
7 frame0
8
9
10

and I try to write name like: Dan
and this not insert this.

you can try it in your computer and help me plss?I dont know what do to I have try everythings.


 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd recommend getting rid of access and trying to use a real database like MySQL with the Type 4 driver.

Failing that, I recommend doing this for your insert:
* get connection
* get statement for insert
* execute insert
* close statement
* get statement for select
* execute select, close ResultSet, close Statement
* close Connection

While you just throw out the results from the select, it is required to 'push' the insert statement through the Type-1 driver since due to a bug it can get stuck.
Another option is to setAutocommit(true) when you open a database Connection

Your code doesn't appear to close database resources when it is done with them, and this can also be the source of errors.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic