JonnyCav
Member
Happy New Year!
Could someone please explain why my 'UPDATE' gives me one of two errors; either 'missing ','' or 'Column count does not exist'?
The INSERT and evrything else works as expected. It's just the UPDATE (two alternatives both presently commented)
Thanks
Could someone please explain why my 'UPDATE' gives me one of two errors; either 'missing ','' or 'Column count does not exist'?
B4X:
Private Sub btnUpdateAttendance_Click
rs=Starter.sql.ExecQuery2 _
("SELECT countID,classes FROM classCount WHERE groupName = ? AND classPeriod = ? AND classYear= ?" _
,Array As String(selectedGroup,txtClassPeriod.Text,AcYear))
Dim count As Int
Dim CID As Int
Do While rs.NextRow
count=(rs.GetString("classes"))
Loop
count=count+1
Log(count)
If count=1 Then
Starter.sql.ExecNonQuery2("INSERT INTO classCount VALUES (null,?,?,?,?)",Array As Object(selectedGroup, AcYear, txtClassPeriod.Text, count))
Else
' Starter.sql.ExecNonQuery("UPDATE classCount SET classes = count WHERE countID = CID")
' Starter.sql.ExecNonQuery2 _
' ("UPDATE classCount SET classes = count WHERE groupName = ? AND classPeriod = ? AND classYear= ?" _
' ,Array As String(selectedGroup,txtClassPeriod.Text,AcYear))
End If
Activity.RemoveAllViews
Activity.LoadLayout("MainLayout")
Activity.Title="Scores and Attendance"
End Sub
The INSERT and evrything else works as expected. It's just the UPDATE (two alternatives both presently commented)
Thanks