bjfhs Active Member Licensed User Longtime User Sep 19, 2019 #1 I can read data from Access,but when use update, Code: sql.BeginTransaction sql.ExecNonQuery("update timu set zd=true where xh ='" & xh & "'") sql.TransactionSuccessful When I close the software,and open the mdb with Access 2010,I find the data doesn't change. I know in VB6,you must use sql.update to make the data real change.How can I do with B4J?
I can read data from Access,but when use update, Code: sql.BeginTransaction sql.ExecNonQuery("update timu set zd=true where xh ='" & xh & "'") sql.TransactionSuccessful When I close the software,and open the mdb with Access 2010,I find the data doesn't change. I know in VB6,you must use sql.update to make the data real change.How can I do with B4J?
Erel B4X founder Staff member Licensed User Longtime User Sep 19, 2019 #2 Better: Code: sql.ExecNonQuery("update timu set zd=true where xh = ?", Array(xh)) Are you sure that the criteria is met? What happens if you insert data? Are you closing the SQL object at some point? Upvote 0
Better: Code: sql.ExecNonQuery("update timu set zd=true where xh = ?", Array(xh)) Are you sure that the criteria is met? What happens if you insert data? Are you closing the SQL object at some point?
bjfhs Active Member Licensed User Longtime User Sep 19, 2019 #3 Erel said: Better: Code: sql.ExecNonQuery("update timu set zd=true where xh = ?", Array(xh)) Are you sure that the criteria is met? What happens if you insert data? Are you closing the SQL object at some point? Click to expand... After I insert data,I can read it with sql.ExecQuery,but when I close my software,and open the mdb with Access2010,I can't find the new data. I close the SQL object when closing the software. Code: Sub MainForm_CloseRequest (EventData As Event) sql.Close End Sub Upvote 0
Erel said: Better: Code: sql.ExecNonQuery("update timu set zd=true where xh = ?", Array(xh)) Are you sure that the criteria is met? What happens if you insert data? Are you closing the SQL object at some point? Click to expand... After I insert data,I can read it with sql.ExecQuery,but when I close my software,and open the mdb with Access2010,I can't find the new data. I close the SQL object when closing the software. Code: Sub MainForm_CloseRequest (EventData As Event) sql.Close End Sub
Erel B4X founder Staff member Licensed User Longtime User Sep 19, 2019 #4 See this: https://www.b4x.com/android/forum/threads/jsql-and-ucanaccess.62909/#post-477390 Upvote 0
bjfhs Active Member Licensed User Longtime User Sep 19, 2019 #5 Erel said: See this: https://www.b4x.com/android/forum/threads/jsql-and-ucanaccess.62909/#post-477390 Click to expand... You are right,after insert data ,the next code is need, Code: sql.ExecNonQuery("COMMIT;") Thank you very much. Upvote 0
Erel said: See this: https://www.b4x.com/android/forum/threads/jsql-and-ucanaccess.62909/#post-477390 Click to expand... You are right,after insert data ,the next code is need, Code: sql.ExecNonQuery("COMMIT;") Thank you very much.