D dragonguy Active Member Licensed User Longtime User Mar 7, 2015 #1 My application have a one Service and 4 Activity Modules, all need to connect to one SQLite database. is it only dim sql at Service Module and another 4 Activity Modules can use it? i mean like this: Service1 code: Code: Sub Process_Globals Dim serv_SQL As SQL End Sub Sub Service_Create If File.Exists(File.DirDefaultExternal, "PhoneData.db3") = True Then serv_SQL.Initialize(File.DirDefaultExternal, "PhoneData.db3", True) End If End Sub and then another modules just use code like this: Code: Query = "UPDATE TblJob Set TimeIn = ?, WHERE CaseNo = ?" Service1.serv_SQL.ExecNonQuery2(Query, Array As String("10:00","1234")) is it correct way to use it? Last edited: Mar 7, 2015
My application have a one Service and 4 Activity Modules, all need to connect to one SQLite database. is it only dim sql at Service Module and another 4 Activity Modules can use it? i mean like this: Service1 code: Code: Sub Process_Globals Dim serv_SQL As SQL End Sub Sub Service_Create If File.Exists(File.DirDefaultExternal, "PhoneData.db3") = True Then serv_SQL.Initialize(File.DirDefaultExternal, "PhoneData.db3", True) End If End Sub and then another modules just use code like this: Code: Query = "UPDATE TblJob Set TimeIn = ?, WHERE CaseNo = ?" Service1.serv_SQL.ExecNonQuery2(Query, Array As String("10:00","1234")) is it correct way to use it?
K keirS Well-Known Member Licensed User Longtime User Mar 7, 2015 #2 You have the right sort of idea but to call a sub from a service you should use CallSubDelayed(). See this tutorial. Upvote 0
You have the right sort of idea but to call a sub from a service you should use CallSubDelayed(). See this tutorial.
D dragonguy Active Member Licensed User Longtime User Mar 8, 2015 #3 Thanks for reply, i like to ask about when i do insert or update sqlite database, is it need to use BeginTransaction and EndTransaction? Upvote 0
Thanks for reply, i like to ask about when i do insert or update sqlite database, is it need to use BeginTransaction and EndTransaction?
E edgar_ortiz Active Member Licensed User Longtime User Mar 8, 2015 #4 define a transaction in the most recommended. At the end you lose nothing. Regards, Edgar Upvote 0