search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

I'm having troubles with databind

Asked by Gabriele
7 years ago.

This is my getDate function:

Private Function GetCalendarData(ByVal start As Date, ByVal [end] As Date) As DataTable
Dim rfTecnico As Integer = Session("idUtente")
Dim da As New SqlDataAdapter("statoric.id, clienti.RagSociale, ISNULL(CAST(statoRic.DataAss AS DATE) + CONVERT(datetime, CONVERT(varchar(10), statoRic.OraDalle / 100)+ ':' + CONVERT(varchar(10), statoRic.OraDalle % 100)) as eventstart, ISNULL(CAST(statoRic.DataAss AS DATE) + CONVERT(datetime, CONVERT(varchar(10), statoRic.OraAlle / 100)+ ':' + CONVERT(varchar(10), statoRic.OraAlle % 100)),0) as eventend
From StatoRic
INNER Join
(Richieste INNER JOIN Clienti
On clienti.IDCliente=Richieste.RFCliente)
On StatoRic.RFRic=Richieste.IDRic
WHERE(RFStato = 11 or RFStato = 12 Or rfstato = 13) And Attuale=1 and NOT (([eventend] <= @start) OR ([eventstart] >= @end)) And RFTecnico=" & rfTecnico, ConfigurationManager.ConnectionStrings("daypilot").ConnectionString)
da.SelectCommand.Parameters.AddWithValue("start", start)
da.SelectCommand.Parameters.AddWithValue("end", [end])

Dim dt As New DataTable()
da.Fill(dt)

Return dt
End Function

statoric.dataass and oradalle and oraalle can be null

I get a null reference exception.
Furthermore when I debug the function I see that start date and end has odd values (like 25-02-3898 and such)

I call the function with this:
DayPilotCalendarWeek.DataSource = GetCalendarData(DayPilotCalendarWeek.StartDate, DayPilotCalendarWeek.EndDate.AddDays(1))

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.