hey all
If I assign datakeyfield as AbsenceID its giving this error
ERROR:A field or property with the name 'AbsenceID ' was not found on the selected data source.
But the datasource dgresult at 1 has the column AbsenceID and the method which it is calling i.e GetLogAbsences
has this query
Query
SELECT AbsenceID, Reason, Comments, convert("varchar",AbsenceStartDate,101)
as AbsenceStartDateDisp, convert("varchar",AbsenceEndDate,101) as AbsenceEndDateDisp
FROM PersonnelAbsences WHERE personnelID= 66 ORDER BY AbsenceStartDate
Datagrid :
Private Sub FilllogAbsencesGrid()
Dim dh As New DataHandlerAdmin
Dim dsResults As DataSet
dglogAbsences.Visible = True
'--- Get sorted equipment list data & display results in data grid.
dsResults = dh.GetLogAbsences(selStaff.SelectedValue, Session("sortColumn"), Session("sortOrder"))------------------------1
If dsResults.Tables(0).Rows.Count > 0 Then
dglogAbsences.Visible = True
lblAdd.Text = "<a href=""#"" onClick=""window.open('absenceAdd.aspx?act=1&personnelID=" & selStaff.SelectedValue & "&siteCode=" & selSite.SelectedValue & "', 'addAbsence', 'width=500,height=440,scrollbars=yes,menubar=no,toolbar=no')"">" & _
"+ Add Absence</a>"
lblMessage.Text = "Employee Absences"
dglogAbsences.DataSource = dsResults
dglogAbsences.DataBind()
Else
dglogAbsences.Visible = False
lblAdd.Text = "<a href=""#"" onClick=""window.open('absenceAdd.aspx?act=1&personnelID=" & selStaff.SelectedValue & "&siteCode=" & selSite.SelectedValue & "', 'addAbsence', 'width=500,height=440,scrollbars=yes,menubar=no,toolbar=no')"">" & _
"+ Add Absence</a>"
lblMessage.Text = "This Employee has no Absences."
End If
The column which iam assigning as datakeyfield is there in the datasource I dont understand why its giving error.
Thanks