Unable to Retrieve Reminder Details from Device Calendar - kotlin

I am able to retrieve all the events from the device calendar from the below code,
#SuppressLint("MissingPermission")
private fun getAccountCalendarEvents(selectedEmail: String) {
var count = 0
val projectionArray =
arrayOf(
CalendarContract.Calendars._ID,
CalendarContract.Events.TITLE,
CalendarContract.Events.DESCRIPTION,
CalendarContract.Events.DTSTART,
CalendarContract.Events.DTEND,
CalendarContract.Events.ALL_DAY,
CalendarContract.Events.EVENT_LOCATION,
CalendarContract.Attendees.ORGANIZER,
CalendarContract.Events.EVENT_TIMEZONE,
CalendarContract.Events.ACCOUNT_TYPE,
CalendarContract.Calendars.ACCOUNT_NAME
)
val startTime = Calendar.getInstance()
startTime.set(Calendar.HOUR_OF_DAY, 0)
startTime.set(Calendar.MINUTE, 0)
startTime.set(Calendar.SECOND, 0)
startTime.add(Calendar.YEAR, -2)
val endTime = Calendar.getInstance()
endTime.add(Calendar.YEAR, 2)
val selection =
"(( " + CalendarContract.Events.DTSTART + " >= " + startTime.timeInMillis + " ) AND ( " + CalendarContract.Events.DTEND + " <= " + endTime.timeInMillis + " ) AND ( deleted != 1 ) AND (account_name = '" + selectedEmail + "'))"
val cursor = contentResolver.query(
CalendarContract.Events.CONTENT_URI,
projectionArray,
selection,
null,
null
)
if (cursor != null && cursor.count > 0 && cursor.moveToFirst()) {
do {
var calendarString = ""
val calendarId = "Id: " + cursor.getInt(0)
val title = "Title: " + cursor.getString(1)
val description = "Description: " + cursor.getString(2)
val startDate = "Start Date: " + cursor.getString(3)
val endDate = "End Date: " + cursor.getString(4)
val allDay = "All Day: " + cursor.getString(5)
val location = "Location: " + cursor.getString(6)
val organizer = "Organizer: " + cursor.getString(7)
val timeZone = "Timezone: " + cursor.getString(8)
val accountType = "Account Type: " + cursor.getString(9)
val accountName = "Account Name: " + cursor.getString(10)
calendarString =
calendarId + "\n" + title + "\n" + description + "\n" + startDate + "\n" + endDate + "\n" + allDay + "\n" + location + "\n" + organizer + "\n" + timeZone + "\n" + accountType + "\n" + accountName
result = if (result.isEmpty()) {
calendarString
} else {
result + "\n\n\n" + calendarString
}
count++
} while (cursor.moveToNext())
}
// txtResults.text = result
Log.e("DCal", "" + count)
getEventsReminders(selectedEmail)
}
This works absolutely fine and perfect.Whereas, when I'm trying to fetch the Reminders from the device with the following code,
#SuppressLint("MissingPermission")
private fun getAccountCalendarReminders(selectedEmail: String) {
var count = 0
val projectionArray =
arrayOf(
CalendarContract.Reminders.EVENT_ID,
CalendarContract.Reminders.METHOD,
CalendarContract.Reminders.MINUTES
)
val startTime = Calendar.getInstance()
startTime.add(Calendar.YEAR, -2)
val endTime = Calendar.getInstance()
endTime.add(Calendar.YEAR, 2)
// val selection =
// "((account_name = '$selectedEmail'))"
val cursor = contentResolver.query(
CalendarContract.Reminders.CONTENT_URI,
projectionArray,
null,
null,
null
)
if (cursor != null && cursor.count > 0 && cursor.moveToFirst()) {
do {
var calendarString = ""
val calendarId = "Id: " + cursor.getInt(0)
val title = "Method: " + cursor.getString(1)
val description = "Minutes: " + cursor.getString(2)
// val startDate = "Title: " + cursor.getString(3)
// val endDate = "End Date: " + cursor.getString(4)
// val allDay = "All Day: " + cursor.getString(5)
// val location = "Location: " + cursor.getString(6)
// val organizer = "Organizer: " + cursor.getString(7)
// val timeZone = "Timezone: " + cursor.getString(8)
// val accountType = "Account Type: " + cursor.getString(9)
// val accountName = "Account Name: " + cursor.getString(10)
calendarString =
calendarId + "\n" + title + "\n" + description
result = if (result.isEmpty()) {
calendarString
} else {
result + "\n\n\n" + calendarString
}
count++
} while (cursor.moveToNext())
}
Log.e("DRem", "" + count)
txtResults.text = result
}
And the output of this Reminders are just,
Could anyone please help me in getting the Reminders Information completely like,
1. Reminder Name,
2. Start Date,
3. Location, etc. the same fields which Events do have.
Note:
I have gone through this library as well,
https://github.com/EverythingMe/easy-content-providers
This library does the same. It doesn't list the reminders from the device calendar.
Code Snippet from the above Lib:
val provider = CalendarProvider(this)
val events = provider.getEvents(id.toLong()).list as ArrayList<Event>
val reminders = provider.getReminders(id.toLong()).list as ArrayList<Event>

Related

Get Years months days hours minutes from moment from duration

const seconds = 1000000
var now = moment(moment.duration(seconds).asSeconds()).format('Y[y],M[m],D[d],H[h]')
I want to format this seconds to years, months, days,hours,minutes so I am not able to get where I am making mistake how can I get this format in React native
this code might help you
export function formatDate(seconds) {
var d = new Date(seconds*1000),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [day,month,year].join('/');
}
this code will return you dd/mm/yyyy. if you want to return date+time then you simply return
export function formatDate(seconds) {
var d = new Date(seconds*1000)
return d.toLocaleString()
}
if you want to get remains time, day, month and year then you should use this code
function secondsToHms(sec) {
sec = Number(sec);
var y = Math.floor(sec/31536000) //<<years
var w= Math.floor(y*31536000)
var w1=Math.floor(w-sec)
w=Math.floor(Math.abs(w1)/604800)//<<weeks
var d=Math.floor(Math.abs(w)*604800)
var d1=Math.floor(Math.abs(d)-Math.abs(w1))
d=Math.floor(Math.abs(d1)/86400)
d=Math.abs(d) //<<day
var h = Math.floor(d*86400);
h=Math.floor(h-Math.abs(d1))
h=Math.floor(Math.abs(h)/3600)//<<hours
var m = Math.floor(sec % 3600 / 60);//<<minutes
var s = Math.floor(sec % 3600 % 60);//<<seconds
var yDisplay = y > 0 ? y + (y == 1 ? " year, " : " years, ") : "0 year, ";
var wDisplay = w > 0 ? w + (w == 1 ? " week, " : " weeks, ") : "0 week, ";
var dDisplay = d > 0 ? d + (d == 1 ? " day, " : " days, ") : "0 day, ";
var hDisplay = h > 0 ? h + (h == 1 ? " hour, " : " hours, ") : "0 hour, ";
var mDisplay = m > 0 ? m + (m == 1 ? " minute, " : " minutes, ") : "0 minute, ";
var sDisplay = s > 0 ? s + (s == 1 ? " second. " : " seconds. ") : "0 second. ";
return yDisplay + wDisplay + dDisplay + hDisplay + mDisplay + sDisplay;
}
console.log(secondsToHms(1000000))

How to avoid every time initialization when value have greater than 0

I have a method that inserts a new record after checking whether it already exists or not.
Here is my method:
protected void btn_save_Click(object sender, EventArgs e)
{
string MobileNo = "";
string replaceValue = txt_mobile.Text.Replace(Environment.NewLine, "$");
string[] values = replaceValue.Split('$');
int uCnt = 0;
int sCnt = 0;
foreach (string item in values)
{
SaveRecord(item.Trim(),out MobileNo,out uCnt,out sCnt);
}
txt_mobile.Text = string.Empty;
if(uCnt > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "BulkSMS System", "alert('Mobile No(s) : "+MobileNo.TrimEnd(',')+" Already Exist');", true);
}
if(sCnt > 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "BulkSMS System", "alert('" + sCnt + " Record(s) Inserted Successfully');", true);
}
Get_Data();
}
public void SaveRecord(string value, out string MobileNo, out int uCnt, out int sCnt)
{
uCnt = 0; //every time initialized to 0
sCnt = 0; //every time initialized to 0
MobileNo = "";
try
{
DataTable dt = new DataTable();
var dot = Regex.Match(value, #"\+?[0-9]{10}");
if (dot.Success)
{
string str = "SELECT TOP 1 [ID],[MobileNo] FROM[dbo].[whitelistdata]";
str += " WHERE [UserID] = '" + Convert.ToInt32(ddl_users.SelectedValue.ToString()) + "' AND [SenderId] = '" + Convert.ToInt32(ddl_senders.SelectedValue.ToString()) + "' AND [MobileNo] = '" + value + "'";
dt = obj.Get_Data_Table_From_Str(str);
if (dt.Rows.Count > 0)
{
uCnt++;
MobileNo += value + ",";
}
else
{
string str1 = "INSERT INTO [dbo].[whitelistdata]([UserID],[SenderId],[KeywordID],[MobileNo])";
str1 += "VALUES (" + Convert.ToInt32(ddl_users.SelectedValue.ToString()) + "," + Convert.ToInt32(ddl_senders.SelectedValue.ToString()) + ",1," + value + ")";
obj.Execute_Query(str1);
sCnt++;
}
}
}
catch (Exception ex)
{
CommonLogic.SendMailOnError(ex);
ClientScript.RegisterStartupScript(this.GetType(), "BulkSMS System", "alert('" + ex.Message.ToString() + "');", true);
}
}
The problem is every time it's set to 0 when method has been called I want to prevent them when previous value is greater than 0.
Please help me guys..
Please first identify which combination check-in database.
if UserID AND SenderId combination Match Then
string str = "SELECT TOP 1 [ID],[MobileNo] FROM[dbo].[whitelistdata]";
str += " WHERE [UserID] = '" + Convert.ToInt32(ddl_users.SelectedValue.ToString()) + "' AND [SenderId] = '" + Convert.ToInt32(ddl_senders.SelectedValue.ToString()) + "'";
if check the only UserID Match Then
string str = "SELECT TOP 1 [ID],[MobileNo] FROM[dbo].[whitelistdata]";
str += " WHERE [UserID] = '" +
Convert.ToInt32(ddl_users.SelectedValue.ToString()) +"'";
if UserID OR SenderId combination Match Then
string str = "SELECT TOP 1 [ID],[MobileNo] FROM[dbo].[whitelistdata]";
str += " WHERE [UserID] = '" + Convert.ToInt32(ddl_users.SelectedValue.ToString()) + "' OR [SenderId] = '" + Convert.ToInt32(ddl_senders.SelectedValue.ToString()) + "'";
if UserID AND SenderId AND MobileNo combination Match Then
string str = "SELECT TOP 1 [ID],[MobileNo] FROM[dbo].[whitelistdata]";
str += " WHERE [UserID] = '" + Convert.ToInt32(ddl_users.SelectedValue.ToString()) + "' AND [SenderId] = '" + Convert.ToInt32(ddl_senders.SelectedValue.ToString()) + "' AND [MobileNo] = '" + value + "'";
You need to use ref rather than out if you want to keep this design1. That means that the method can assume that the variables are already initialised and you're not forced to re-initialise them within the method:
public void SaveRecord(string value,out string MobileNo,ref int uCnt,ref int sCnt)
{
//uCnt = 0; //initialized by caller
//sCnt = 0; //initialized by caller
MobileNo = ""; //?
....
And at the call site:
SaveRecord(item.Trim(),out MobileNo,ref uCnt,ref sCnt);
You'll also want to do something about MobileNo too if you expect that to accumulate values rather than be over-written each time through the loop. Maybe make it a StringBuilder instead that you just pass normally (no ref or out) and let the SaveRecord method append to. out is definitely wrong for it.
1Many people would frown at a method that clearly wants to return values being declared void and making all returns via ref/out.
Something like:
public bool SaveRecord(string value)
{
...
Returning true for a new record, false for an existing record. I'd probably take out the exception handling from there and let the exception propagate higher before it's handled. Then the call site would be:
if(SaveRecord(item.Trim()))
{
sCnt++;
}
else
{
uCnt++;
MobileNo += item.Trim + ","
}

SQL Join Query taking long to complete

I am working on a project that require me to join four tables. I have written this code but it's taking forever to finish. Please help. Ohhh I have about 121 000 entries in the Db
PortfolioCollectionDataContext context = null;
context = DataContext;
var Logins = from bkg in context.EnquiryBookings
where bkg.Paid == true
from log in context.Logins
where log.LoginID == bkg.LoginID
from enq in context.Enquiries
where enq.EnquiryID == bkg.EnquiryID
from estb in context.Establishments
where enq.EstablishmentID == estb.EstablishmentID
select new
{
log.LoginID,
log.FirstName,
log.LastName,
log.CountryOfResidence,
log.EmailAddress,
log.TelephoneNumber,
bkg.TotalPrice,
estb.CompanyName
};
string str = "";
foreach (var user in Logins)
{
str += ("[Name: " + user.LastName + " " + user.FirstName + " - Country: " + user.CountryOfResidence + " - Phone: " + user.TelephoneNumber + " - Email: " + user.EmailAddress + " - Booked From: " + user.CompanyName + " - Spent: " + user.TotalPrice.ToString() + "]");
}
return str;
Use following query on LINQ
PortfolioCollectionDataContext context = null;
context = DataContext;
var Logins = from bkg in context.EnquiryBookings
join log in context.Logins
on log.LoginID equals bkg.LoginID
&& bkg.Paid == true
join enq in context.Enquiries
on enq.EnquiryID equals bkg.EnquiryID
join estb in context.Establishments
on enq.EstablishmentID == estb.EstablishmentID
select new
{
str = "[Name: " + log.LastName + " " + log.FirstName + " - Country: " + log.CountryOfResidence + " - Phone: "
+ log.TelephoneNumber + " - Email: " + log.EmailAddress + " - Booked From: "
+ estb.CompanyName + " - Spent: " + bkg.TotalPrice.ToString() + "]"
};
string output = string.Join(", ", Logins.ToList());
return output;
Check your query by taking cursor on Logins and paste that query here. Then check an estimated execution plan of your query and paste here.
If using SQL Server, to get execution plan of your query using Sql server management studio, click on an icon highlighted in an image below.

'IN' query in fusion table

In the following code, i want to add "IN" +Village+. Where to add this condition in the code. Variable village takes value from a drop down list based on that filter should occur.please help me.Village name is a column in my fusion table.
i.e select 'geometry',villageName from table where querypass > textvalue IN villagename='madurai'
function querymape()
{
/*variable holds the value*/
var village =document.getElementById('village').value.replace(/'/g, "\\'");
var operatore=document.getElementById('operatorstringe').value.replace(/'/g, "\\'");
var textvaluee=document.getElementById("text-valuee").value.replace(/'/g, "\\'");
var querypasse=document.getElementById('query-passe').value.replace(/'/g, "\\'");
{
layer.setQuery("SELECT 'geometry'," + querypasse + " FROM " + tableid + " WHERE " + querypasse + " " + operatore + " '" + textvaluee + "'"+"AND 'VillageName=+village+'");
}
}
/*This is my new code.But its not working.Please help me*/
function querymap()
{
//var villagename='';
var operator=document.getElementById('operatorstring').value.replace(/'/g, "\\'");
var textvalue=document.getElementById("text-value").value.replace(/'/g, "\\'");
var querypass=document.getElementById('query-pass').value.replace(/'/g, "\\'");
var searchStringe = document.getElementById('Search-stringe').value.replace(/'/g, "\\'");
{
layer.setQuery("SELECT 'geometry'," + querypass + " FROM " + tableid + " WHERE " + querypass + " " + operator + " '" + textvalue + "'"+"AND 'VillageName'="+ searchStringe+"");
}
}
Multiple conditions can be combined using the keyword "and"?
You twisted the IN syntax around, it is used when you want to match several values, if you only want to compare to a single value use "=" instead
Applied to your query (with IN syntax):
select 'geometry',villageName from table where querypass > textvalue and villagename IN ('madurai','another village')
With = syntax:
select 'geometry',villageName from table where querypass > textvalue and villagename = 'madurai'

Database with 5 Tables with Insert and Select

my problem is that i have 5 tables and need inserts and selects.
what i did is for every table a class and there i wrote the SQL Statements like this
public class Contact
private static String IDCont = "id_contact";
private static String NameCont = "name_contact";
private static String StreetCont = "street_contact";
private static String Street2Cont = "street2_contact";
private static String Street3Cont = "street3_contact";
private static String ZipCont = "zip_contact";
private static String CityCont = "city_contact";
private static String CountryCont = "country_contact";
private static String Iso2Cont = "iso2_contact";
private static String PhoneCont = "phone_contact";
private static String Phone2Cont = "phone2_contact";
private static String FaxCont = "fax_contact";
private static String MailCont = "mail_contact";
private static String Mail2Cont = "mail2_contact";
private static String InternetCont = "internet_contact";
private static String DrivemapCont = "drivemap_contact";
private static String PictureCont = "picture_contact";
private static String LatitudeCont = "latitude_contact";
private static String LongitudeCont = "longitude_contact";
public static final String TABLE_NAME = "contact";
public static final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" +
IDCont + "INTEGER not NULL," +
NameCont + " TEXT not NULL," +
StreetCont + " TEXT," +
Street2Cont + " TEXT," +
Street3Cont + " TEXT," +
ZipCont + " TEXT," +
CityCont + " TEXT," +
CountryCont + " TEXT," +
Iso2Cont + " TEXT," +
PhoneCont + " TEXT," +
Phone2Cont + " TEXT," +
FaxCont + " TEXT," +
MailCont + " TEXT," +
Mail2Cont + " TEXT," +
InternetCont + " TEXT," + //website of the contact
DrivemapCont + " TEXT," + //a link to a drivemap to the contact
PictureCont + " TEXT," + //a photo of the contact building (contact is not a person)
LatitudeCont + " TEXT," +
LongitudeCont + " TEXT," +
"primary key(id_contact)" +
"foreign key(iso2)";
and my insert looks like this
public boolean SQL_INSERT_CONTACT(int IDContIns, String NameContIns, String StreetContIns,
String Street2ContIns, String Street3ContIns, String ZipContIns,
String CityContIns, String CountryContIns, String Iso2ContIns,
String PhoneContIns, String Phone2ContIns, String FaxContIns,
String MailContIns, String Mail2ContIns, String InternetContIns,
String DrivemapContIns, String PictureContIns, String LatitudeContIns,
String LongitudeContIns) {
try{
db.execSQL("INSERT INTO " + "contact" +
"(" + IDCont + ", " + NameCont + ", " + StreetCont + ", " +
Street2Cont + ", " + Street3Cont + ", " + ZipCont + ", " +
CityCont + ", " + CountryCont + ", " + Iso2Cont + ", " +
PhoneCont + ", " + Phone2Cont + ", " + FaxCont + ", " +
MailCont + ", " + Mail2Cont + ", " + InternetCont + ", " +
DrivemapCont + ", " + PictureCont + ", " + LatitudeCont + ", " +
LongitudeCont + ") " +
"VALUES (" + IDContIns + ", " + NameContIns +", " + StreetContIns + ", " +
Street2ContIns + ", " + Street3ContIns + ", " + ZipContIns + ", " +
CityContIns + ", " + CountryContIns + ", " + Iso2ContIns + ", " +
PhoneContIns + ", " + Phone2ContIns + ", " + FaxContIns + ", " +
MailContIns + ", " + Mail2ContIns + ", " + InternetContIns + ", " +
DrivemapContIns + ", " + PictureContIns + ", " + LatitudeContIns + ", " +
LongitudeContIns +")");
return true;
}
catch (SQLException e) {
return false;
}
}
i have a DBAdapter class there i created the database
public class DBAdapter {
public static final String DB_NAME = "mol.db";
private static final int DB_VERSION = 1;
private static final String TAG = "DBAdapter"; //to log
private final Context context;
private SQLiteDatabase db;
public DBAdapter(Context context)
{
this.context = context;
OpenHelper openHelper = new OpenHelper(this.context);
this.db = openHelper.getWritableDatabase();
}
public static class OpenHelper extends SQLiteOpenHelper
{
public OpenHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
#Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
db.execSQL(Contact.SQL_CREATE);
db.execSQL(Country.SQL_CREATE);
db.execSQL(Picture.SQL_CREATE);
db.execSQL(Product.SQL_CREATE);
db.execSQL(Project.SQL_CREATE);
}
#Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
Log.w(TAG, "Upgrading database from version "
+ oldVersion + " to " + newVersion
+ ", which will destroy all old data");
db.execSQL(Contact.SQL_DROP);
db.execSQL(Country.SQL_DROP);
db.execSQL(Picture.SQL_DROP);
db.execSQL(Product.SQL_DROP);
db.execSQL(Project.SQL_DROP);
onCreate(db);
}
i found so many different things and tried them but i didn't get anything to work...
i need to know how can i access the database in my activity
and how i can get the insert to work
and is there sth wrong in my code?
thanks for your help
thats how i tried to get it into my activity
public class MainTabActivity extends TabActivity {
private Context context;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.maintabactivity);
TabHost mTabHost = getTabHost();
Intent intent1 = new Intent().setClass(this,MapOfLight.class);
//Intent intent2 = new Intent().setClass(this,Test.class); //Testactivity
//Intent intent2 = new Intent().setClass(this,DetailView.class); //DetailView
Intent intent2 = new Intent().setClass(this,ObjectList.class); //ObjectList
//Intent intent2 = new Intent().setClass(this,Gallery.class); //Gallery
Intent intent3 = new Intent().setClass(this,ContactDetail.class);
mTabHost.addTab(mTabHost.newTabSpec("tab_mol").setIndicator(this.getText(R.string.mol), getResources().getDrawable(R.drawable.ic_tab_mol)).setContent(intent1));
mTabHost.addTab(mTabHost.newTabSpec("tab_highlights").setIndicator(this.getText(R.string.highlights),getResources().getDrawable(R.drawable.ic_tab_highlights)).setContent(intent2));
mTabHost.addTab(mTabHost.newTabSpec("tab_contacts").setIndicator(this.getText(R.string.contact),getResources().getDrawable(R.drawable.ic_tab_contact)).setContent(intent3));
mTabHost.setCurrentTab(1);
SQLiteDatabase db;
DBAdapter dh = null;
OpenHelper openHelper = new OpenHelper(this.context);
dh = new DBAdapter(this);
db = openHelper.getWritableDatabase();
dh.SQL_INSERT_COUNTRY("AT", "Austria", "AUT");
}
}
i tried it with my country table because it has only 3 columns
public class Country {
private static String Iso2Count = "iso2_country";
private static String NameCount = "name_country";
private static String FlagCount = "flag_image_url_country";
public static final String TABLE_NAME = "country";
public static final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" +
Iso2Count + " TEXT not NULL," +
NameCount + " TEXT not NULL," +
FlagCount + " TEXT not NULL," +
"primary key(iso2_country)";
public boolean SQL_INSERT_COUNTRY(String Iso2CountIns, String NameCountIns, String FlagCountIns) {
try{
db.execSQL("INSERT INTO " + "country" +
"(" + Iso2Count + ", " + NameCount + ", " + FlagCount + ") " +
"VALUES ( " + Iso2CountIns + ", " + NameCountIns +", " + FlagCountIns + " )");
return true;
}
catch (SQLException e) {
return false;
}
}
another question is it better to put the insert and select from each table into a separate class, so i have 1 class for each table or put them all into the DBAdapter class?
EDIT: I'm not sure you have shown all your code and therefore I'm not sure my answer is helpful. Where do you declare the variables IDCont, NameCont, StreetCont ... ? I assume they are constants defining the names of your fields. In which case my answer is not correct as that should form a valid INSERT statement.
Can you add the error messages you are seeing as well as being more specific on the DB server you are using?
Your INSERT statement will not work because you are inserting the values of the variables passed to the function, instead of specifying the names of the columns.
The first part of the statment should be all one string:
"INSERT INTO contact (IDCont, NameCont, StreetCont, Street2Cont, Street3Cont, ZipCont," +
"CityCont, CountryCont, Iso2Cont, PhoneCont, Phone2Cont, FaxCont, MailCont, " +
"Mail2Cont, InternetCont, DrivemapCont, PictureCont, LatitudeCont, LongitudeCont) "
"VALUES ("IDContIns + ", " + NameContIns +", " + StreetContIns + ", " +
Street2ContIns + ", " + Street3ContIns + ", " + ZipContIns + ", " +
CityContIns + ", " + CountryContIns + ", " + Iso2ContIns + ", " +
PhoneContIns + ", " + Phone2ContIns + ", " + FaxContIns + ", " +
MailContIns + ", " + Mail2ContIns + ", " + InternetContIns + ", " +
DrivemapContIns + ", " + PictureContIns + ", " + LatitudeContIns + ", " +
LongitudeContIns +")"
I would also question your table design, why are most of the fields TEXT and not a more appropriate data type?