The string passed to my custom function is the following:
SELECT key FROM ubis WHERE MemberID = '144'
AND To >='11/7/2009 9:11:23 pm'
AND From <= '11/7/2009 9:11:23 pm'
Public Shared Function GetDataTable(ByVal CmdText As String) As DataTable
Dim myConn As New SqlConnection(ConfigurationManager.ConnectionStrings("Conn").ConnectionString)
Dim myCmd As New SqlCommand(CmdText, myConn)
myConn.Open()
Dim myReader As SqlDataReader = myCmd.ExecuteReader()
Dim myTable As New DataTable()
myTable.Load(myReader)
myConn.Close()
Return (myTable)
End Function
and here is the error i get, Conversion failed when converting datetime from character string
I understand that the the datetime fields are passed as string into the function, but what options do i have?