I'm trying to pass a Date value from DB field to a Calendar control using DataReader.
It gives me following error:
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Exception Details: System.InvalidOperationException: No data exists for the row/column.
Source Error:
Line 83: .DataBind()
Line 84: End With
Line 85: calBirthDate.SelectedDate = CDate(dr("BirthDate"
)
Line 86: 'Response.Write(CDate(dr("BirthDate"
))
Line 87: End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Here is the code.
DataGrid - gr displays data just fine
but I can't display the value of the field using response. write (dr.item("BirthDate"
) - i get the same error
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub rblEmpl_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rblEmpl.SelectedIndexChanged
Dim strSQL As String
Dim strConn As String
Dim dr As OleDb.OleDbDataReader
strConn = Session("ConnectString"
strSQL = "Select EmployeeID, BirthDate FROM Employees where EmployeeID = " & rblEmpl.Items(rblEmpl.SelectedIndex).Value
dr = DataHandler.GetDataReader(strSQL, strConn)
With gr
.DataSource = dr
.DataBind()
End With
calBirthDate.SelectedDate = CDate(dr("BirthDate"
)
End Sub
It gives me following error:
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Exception Details: System.InvalidOperationException: No data exists for the row/column.
Source Error:
Line 83: .DataBind()
Line 84: End With
Line 85: calBirthDate.SelectedDate = CDate(dr("BirthDate"
Line 86: 'Response.Write(CDate(dr("BirthDate"
Line 87: End Sub
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Here is the code.
DataGrid - gr displays data just fine
but I can't display the value of the field using response. write (dr.item("BirthDate"
++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub rblEmpl_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rblEmpl.SelectedIndexChanged
Dim strSQL As String
Dim strConn As String
Dim dr As OleDb.OleDbDataReader
strConn = Session("ConnectString"
strSQL = "Select EmployeeID, BirthDate FROM Employees where EmployeeID = " & rblEmpl.Items(rblEmpl.SelectedIndex).Value
dr = DataHandler.GetDataReader(strSQL, strConn)
With gr
.DataSource = dr
.DataBind()
End With
calBirthDate.SelectedDate = CDate(dr("BirthDate"
End Sub