This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / help. after insert, how can I select immediately. help, helpI have some user personal data need insert to db and get the insert index immediately to create dynamic presentation., but right now, I can only insert the data into databse, but can not get the correct query result set just after the insert command was executed. I only can get the correct resultset in a later time. (the query sql command is just the same.) I forward the select query into another page, but it does not work either. How come. the data did not commit? or some other question.
please help me
-gemlan(gem);
2001-6-6
{509}
(#92717@0)
-
no body have this kind of experience? jsp /java expert come in.
-gemlan(gem);
2001-6-7
(#93300@0)
-
If your database is MS SQL Server, you can get it by "SELECT @@IDENTITY AS Identity".
-cyin003(Jerry);
2001-6-9
(#95706@0)
-
What do you mean by saying "a later time"? Check the jdbc connection, and set auto-commit to true. Or if you use some other codes above jdbc to do all database operations, check these codes to ensure that they donot' cache query results.
-bloor(不算太老);
2001-6-7
(#93327@0)
-
where's the code.I can reach the id generated by system in another session.
-gemlan(gem);
2001-6-7
{58}
(#93334@0)
-
maybe I can do the job in another connection, but does not that waste the resources. by the way, I am not familiar with the CS and also, I have no programming experience, I started do it half year ago.
-gemlan(gem);
2001-6-7
{614}
(#93365@0)
-
I started to use Java from last Nov. when I join my send company in Canada. I don't know if it's a correct choice, although I can do java years ago.You should be using interface java.sql.Connection, right? Check the java api at sun.com, you will find these methods:
1. getAutoCommit(): Gets the current auto-commit state.
2. setAutoCommit(boolean autoCommit): Sets this connection's auto-commit mode.
-bloor(不算太老);
2001-6-7
{259}
(#93380@0)
-
thank you. i will try that method, but before I get your suggestion, I tried to add another sql command just execute the commit after the insert one, I still face the bug as it was.
-gemlan(gem);
2001-6-7
(#93394@0)
-
gemlan 请进你好,我也在学JAVA,我们可以互相交流一下吗?
我的MAIL :tt28tt@hotmail.com
-guest:tt;
2001-6-9
{76}
(#95869@0)
-
u r right,I think
-wendywendy(wind);
2001-6-9
(#95553@0)