systems1 Member Licensed User Longtime User Jun 9, 2012 #1 Hi all, Iam new to android I created a sample sqlite database program. which insert name of a user to table. my problem is when i restart emulator and run my sample program i cant see the previous datas i inserted in my table. Also where is the database located? is it possible to view database I attached my code herewith. Please Help me Regards, :sign0085::sign0085:
Hi all, Iam new to android I created a sample sqlite database program. which insert name of a user to table. my problem is when i restart emulator and run my sample program i cant see the previous datas i inserted in my table. Also where is the database located? is it possible to view database I attached my code herewith. Please Help me Regards, :sign0085::sign0085:
klaus Expert Licensed User Longtime User Jun 9, 2012 #2 You should remove these lines in Activity_Create in the display module. Code: Copy Sub Activity_Create(FirstTime As Boolean) ' If SQL1.IsInitialized = False Then ' SQL1.Initialize(File.DirDefaultExternal, "test1.db", True) ' End If And change this line: Code: Copy cursor1 = Main.SQL1.ExecQuery("SELECT * FROM user") The database is already declared as a process global object in the Main module so no need to redeclare it in the display module. In your code in the display module your initialize a NEW database with the same name, so won't find the inserted names. Best regards. Upvote 0
You should remove these lines in Activity_Create in the display module. Code: Copy Sub Activity_Create(FirstTime As Boolean) ' If SQL1.IsInitialized = False Then ' SQL1.Initialize(File.DirDefaultExternal, "test1.db", True) ' End If And change this line: Code: Copy cursor1 = Main.SQL1.ExecQuery("SELECT * FROM user") The database is already declared as a process global object in the Main module so no need to redeclare it in the display module. In your code in the display module your initialize a NEW database with the same name, so won't find the inserted names. Best regards.
systems1 Member Licensed User Longtime User Jun 9, 2012 #3 Thank you for your replay klaus. it is fine But now i got another probelm i changed this sample program to a student view and add program. i have two buttons ADD STUDENT , VIEW STUDENT I added a student and come back to view student. i got the student details in grid. then i again added a student then i came back to view student ican't find the student there. I don't understand what is happening here. I attached my code herewith. Please Help me. Regards, :sign0085::sign0085: Attachments sample2.zip sample2.zip 8.8 KB · Views: 281 Upvote 0
Thank you for your replay klaus. it is fine But now i got another probelm i changed this sample program to a student view and add program. i have two buttons ADD STUDENT , VIEW STUDENT I added a student and come back to view student. i got the student details in grid. then i again added a student then i came back to view student ican't find the student there. I don't understand what is happening here. I attached my code herewith. Please Help me. Regards, :sign0085::sign0085:
klaus Expert Licensed User Longtime User Jun 9, 2012 #4 Here you are. The problem you had is that you filled the ScrollView in Activity_Create and not in Activity_Resume. When leaving the display activity it's paused and when you come back from the addstudent Activity the Activity_Create routine is not called. The attached modified program works. I added also Activity.Finish in the Activity_Pause routines. Replaced ExitApplication by Activity.Finish in the Main module. Best regards. Attachments sample3.zip sample3.zip 13.4 KB · Views: 311 Upvote 0
Here you are. The problem you had is that you filled the ScrollView in Activity_Create and not in Activity_Resume. When leaving the display activity it's paused and when you come back from the addstudent Activity the Activity_Create routine is not called. The attached modified program works. I added also Activity.Finish in the Activity_Pause routines. Replaced ExitApplication by Activity.Finish in the Main module. Best regards.
systems1 Member Licensed User Longtime User Jun 9, 2012 #5 yes that's works fine for me Thank you claus for helping me Regards, :sign0142: :sign0060: Upvote 0