+ Start a Discussion
RiyajRiyaj 

Update Record does not update...... Why?

Hi
When executing  the follwing aspx code.. Record does not update...... Why?


Apex Code 

global class UpdateAttendanceList{
WebService static void UpdateAttendanceFromClassname(string classname,string studentname,string attendance){

List<Attendance__c> lstConts = new List<Attendance__c>();

lstConts=[Select student_Name__c,attendance_Roll__c from Attendance__c where class_Name__r.Name= :classname AND student_Name__r.Name= :studentname LIMIT 1];

if(lstConts.size() > 0)

{

Attendance__c conts = new Attendance__c();

conts = lstConts[0];

conts.attendance_Roll__c= attendance;
update conts;

}
}

 

Aspx Code

 

updateAttendanceObj.SessionHeaderValue = new UpdateAttendanceList.SessionHeader();

updateAttendanceObj.SessionHeaderValue.sessionId = sessionId;
updateAttendanceObj.UpdateAttendanceFromClassname(sClassName, sStudentname, attendanceText);

System.QueryException: List has no rows for assignment to SObject

Jia HuJia Hu
Check your SOQL query and the conditions,
you didn't return any record in the query.