Sub LocalSQL
Dim Cnt As Int
Dim pict As Bitmap
Dim VIPNew As String
Dim VIPfin As String
' This Part is IMPORTANT
Starter.SQL1.ExecNonQuery("DROP TABLE IF EXISTS VIPList")
txt="CREATE TABLE IF NOT EXISTS VIPList (Serial INTEGER PRIMARY KEY AUTOINCREMENT, DisplayName TEXT, TelNumber TEXT)"
Starter.SQL1.ExecNonQuery(txt)
'To Here
txt="SELECT * FROM VIPList"
Starter.Cursor1=Starter.SQL1.ExecQuery(txt)
ProgressDialogShow("Fetching your VIP Contact List")
listOfContacts = Contacts2.GetContactsByQuery("starred="&1,Null,True,False)
' Add Starred Contacts First
For i = 0 To listOfContacts.Size - 1
Contact = listOfContacts.Get(i)
'Log(Contact)
Dim phones As Map
phones = Contact.GetPhones
If phones.Size > 0 Then
Cnt = Cnt + 1
pict = Contact.GetPhoto
'Log("Count: "&Cnt&", "&Contact.DisplayName&", Starred: "&Contact.Starred)
VIPNew = "+27"&sf.Mid(Contact.PhoneNumber,2,9)
' SQL1.ExecNonQuery("INSERT INTO VIPList VALUES("&Cnt&", "&Contact.Name&", "&Contact.PhoneNumber&")")
Starter.SQL1.ExecNonQuery2("INSERT INTO VIPList VALUES(?, ?, ?)", Array As Object(Cnt, Contact.Name, VIPNew))
End If
Next
End Sub