Private Sub SetData(Mime As String, Values As ContentValues, id As Long, Update As Boolean)
If Update Then
cr.Update(dataUri, Values, "mimetype = ? AND contact_id = ?", Array As String(Mime, id))
Else
Try
Dim crsr As Cursor = cr.Query(contactUri, Array As String("name_raw_contact_id"), _
"_id = ?", Array As String(id), "")
If crsr.RowCount = 0 Then
Log("Error getting raw_contact_id")
crsr.Close
Return
End If
crsr.Position = 0
Values.PutString("raw_contact_id", crsr.GetString("name_raw_contact_id"))
crsr.Close
Catch
Values.PutString("raw_contact_id", id)
End Try
Values.PutString("mimetype", Mime)
cr.Insert(dataUri, Values)
End If
End Sub