Ok heres my problem which i'm starting to find very annoying :S
I am trying to load a date stored on my sql server database into a date time picker.
Dim MyDate As Date = (DetailLookup("PLIExpiry", "tblConcessions", "ConcessionID", varCompanyKey))
frmConcessions.dtpPPLIExiryDate.Value = MyDate
DetailLookup is a public function that obtains data from the database.
Public Function DetailLookup(ByVal varColumnIn As String, ByVal varTableIn As String, ByVal varIDTypeIn As String, ByVal varCompanyIDIn As String)
objCommand.Connection = objConnection
Dim varCommand As String = "SELECT " & varColumnIn & " FROM " & varTableIn & " WHERE " & varIDTypeIn & "='" & varCompanyIDIn & "';"
Dim da As SqlDataReader
Dim Reading As String
objConnection.Open()
objCommand.CommandText = varCommand
da = objCommand.ExecuteReader
da.Read()
Reading = (da(varColumnIn))
objConnection.Close()
Return Reading
End Function
The result of this is that there are no errors; instead the datetimepicker just displays todays date. I am completely bamboozled as to why this does not work! Can anybody help?
Many thanks
Atove