Here us the full SUB...
Sorry I am new to Basic4android and need some hand holding....conquered a lot on my own but this is has got me stuck. Anyhow here is the relevant SUB
Seven Variables (SundayX to SaturdayX) start with 0 (int type) and dependent upon checkboxes they are set to TRUE or FALSE, but I used an integer 0 or 1 instead of boolean to avoid any further issues with boolean types.
If the profile does NOT exist a new row is inserted into the SQL db successfully. But if cursor count > 0 then it must be present already so ELSE comes into play, and then I want to update that record instead.
The creation, and inserting works fine. I have tested the tables with sql browser and they data is complete and accurate.
Sub FillProfile
Dim SundayX As Int = 0
Dim MondayX As Int = 0
Dim TuesdayX As Int = 0
Dim WednesdayX As Int = 0
Dim ThursdayX As Int = 0
Dim FridayX As Int = 0
Dim SaturdayX As Int = 0
If chkSun.Checked = True Then
SundayX = 1
End If
If chkMon.Checked = True Then
MondayX = 1
End If
If chkTues.Checked = True Then
TuesdayX = 1
End If
If chkWed.Checked = True Then
WednesdayX = 1
End If
If chkThur.Checked = True Then
ThursdayX = 1
End If
If chkFri.Checked = True Then
FridayX = 1
End If
If chkSat.Checked = True Then
SaturdayX = 1
End If
SQLLover.Initialize(File.DirRootExternal, "/Lover/Lover.db", True)
Dim Cursor1 As Cursor
Cursor1 = SQLLover.ExecQuery2("SELECT Mobile, Name, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, StartTime, EndTime FROM Profiles WHERE Mobile = ? AND Name = ?", Array As String(Nos, Nme))
'Row many rows with this criteria.....hopefully only 1
If Cursor1.RowCount = 0 Then 'No profile exists
SQLLover.ExecNonQuery2("INSERT INTO Profiles VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object(Nos, Nme, SundayX, MondayX, TuesdayX, WednesdayX, ThursdayX, FridayX, SaturdayX, lblTimeFrom.text, lblTimeTo.Text))
Else 'Profile already exists
Msgbox("Client Profile already exists","Profile will be updated")
***** THIS is the Syntax I am having problems with 8 *****
SQLLover.ExecNonQuery2("Update Profiles SET(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object(Nos, Nme, SundayX, MondayX, TuesdayX, WednesdayX, ThursdayX, FridayX, SaturdayX, lblTimeFrom.Text, lblTimeTo.Text))
End If
End Sub
** The more I read perhaps I need a WHERE statement in here somewhere?
Any way If you can get this working I can continue my project
thanks very much
RP