JonnyCav
Member
I'm inserting records into an sqlite database and every entry works fine EXCEPT to 'studentID' which always submits the last record id value that was in the resultset from my query.
ALSO, it isn't committing the data to the database?
Thanks
B4X:
Private Sub Update_Attendance
Activity.RemoveAllViews
Activity.LoadLayout("AttendanceLayout")
Activity.Title="Attendance for: " & selectedGroup
DateTime.DateFormat="dd-MMM-yyyy"
Dim cdate As String
cdate=DateTime.Date(DateTime.Now)
txtClassDate.Text=cdate
get_month
If month="September" Then
txtClassPeriod.Text=1
Else If month="October" Then
txtClassPeriod.Text=2
Else If month="November" Then
txtClassPeriod.Text=3
Else If month="December" Then
txtClassPeriod.Text=4
Else If month="Februrary" Then
txtClassPeriod.Text=5
End If
period=txtClassPeriod.Text
rs=Starter.sql.ExecQuery2("SELECT studentId, studentName FROM students WHERE groupName =?",Array As String(selectedGroup))
Do While rs.NextRow
Dim pa As Panel
pa.Initialize("")
pa.LoadLayout("ListOfStudents")
pa.SetLayoutAnimated(0,0,0,clvAttendance.AsView.Width,60dip)
txtStudents.Text = rs.GetString("studentID")
cbStudents.Text = rs.GetString("studentName")
clvAttendance.Add(pa,"")
Loop
End Sub
Private Sub rbGroup_CheckedChange(Checked As Boolean)
Dim index As Int = clvAttendance.GetItemFromView(Sender)
Dim p As B4XView =clvAttendance.GetPanel(index)
Dim r As RadioButton=Sender
If r.Checked Then
selectedGroup=(p.GetView(0).Text)
End If
Log(selectedGroup)
Update_Attendance
' Attendance_Table
End Sub
Private Sub cbStudents_CheckedChange(Checked As Boolean)
Dim CB As CheckBox = Sender
Dim sID As Int
sID=txtStudents.Text
Log(selectedGroup)
Log (CB.Text & " : " & CB.Checked)
Log(txtStudents.Text)
Starter.sql.ExecNonQuery2("INSERT INTO attendance VALUES (?, ?, ? ,?, ?, ?)", Array As Object(sID, selectedGroup, CB.Text, txtClassDate.Text, txtClassPeriod.Text, "P"))
ToastMessageShow("Entry added", False)
End Sub
Private Sub btnUpdateAttendance_Click
'PUT THE SQLITE INSERT HERE FOR ALL TICKED BOXES IN A GIVEN GROUP
End Sub
ALSO, it isn't committing the data to the database?
Thanks