Accessing Data Base

walterf25

Expert
Licensed User
Longtime User
Ok, i have been researching for about a week today and so far i have not been able to find a simple example that will show me how to access the data stored in a database file (db) so far all the examples i can find only show me how to create a db file if not created and how to add data to it programatically, all i need is a simple example that will show me how to access the records from a file i created and saved it in my SD card i would like to have 2 buttons to navigate through the records "Previous" and "Next" can anybody please, pretty please help me with this, i actually found one example that comes with the beginners guide but i feel it to be a little too complex for my level, if anyone can please give me an example or point me to where i can find one i will really appreciate it.
Hope i can get some answers here guys.

Thanks,
:sign0163:
 
Any idea why is this happenning? Is this the limitation of the emulator to read data file less then 1mb?
Will it works on the actual device? :sign0163:

Thanks
 
Upvote 0
Any idea why is this happenning?

works like a charm:

Code:
Sub Process_Globals

   Dim SQL1 As SQL 

End Sub

Sub Globals

   Dim EditText1 As EditText

End Sub

Sub Activity_Create(FirstTime As Boolean)

   EditText1.Initialize("EditText1")

   Activity.AddView(EditText1, 0, 0, 100%X, 100%Y)

   If File.Exists(File.DirInternal, "allbasicdata.sl3") = False Then
      File.Copy(File.DirAssets, "allbasicdata.sl3", File.DirInternal, "allbasicdata.sl3")
   End If

   SQL1.Initialize(File.DirInternal, "allbasicdata.sl3", False)

   Dim Cursor1 As Cursor
   
   Cursor1 = SQL1.ExecQuery("Select * From CREW")
   
   Dim RowCounter As Int
   Dim ColCounter As Int
   
   Dim SB As StringBuilder

   SB.Initialize
   
   For RowCounter = 0 To Cursor1.RowCount - 1
   
      Cursor1.Position = RowCounter

      For ColCounter = 0 To Cursor1.ColumnCount - 1
   
         SB.Append(Cursor1.GetColumnName(ColCounter)).Append(": ").Append(Cursor1.GetString2(ColCounter)).Append(CRLF)
         
      Next
   
      SB.Append(CRLF)
      
   Next

   EditText1.Text = SB.ToString

End Sub

Greetings ... Kiffi
 

Attachments

Upvote 0
Hi Kiffi,

Thanks for the help. It still doesn't open a big data file.

The allbasicdata file I've given was a small portion(about 5%) of my original file. I still can not open the bigger file in any of the exsample code here.

I could use it on Basic4ppc without problem!


Regards
 
Upvote 0
Hi All,

I would like to say a BIG thanks you to all. :sign0098:

Yes Erel sugestion of changing the file extension to jpg works very well. Now I can start my project and think on a work around to re-name the original data file.

Thanks again and best regards
TC
 
Upvote 0
Back
Top