Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Arithmetic overflow for SmallDatetime

$
0
0

Hi,

I hope someone can help, I have the following script that I am using,

Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString)
        conn.Open()
        Dim cmd As SqlCommand = conn.CreateCommand()
        cmd.CommandText = "SELECT * FROM dbo.tbl_Files  WHERE (@StartDate <= uploadeddate AND @EndDate >= uploadeddate) FOR XML PATH ('')),1,1,'') as List"
        cmd.CommandType = CommandType.Text

        cmd.Parameters.AddWithValue("@StartDate", Session("SelectedFromDate"))
        cmd.Parameters.AddWithValue("@EndDate", Session("SelectedToDate"))

        Dim reader As SqlDataReader = cmd.ExecuteReader()
        While reader.Read()

            B3List = reader("List").ToString

        End While
        reader.Close()
        conn.Close()

but recieve an error:

Arithmetic overflow error converting expression to data type smalldatetime. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Arithmetic overflow error converting expression to data type smalldatetime.

the session("SelectedFromDate") is typically, 30/04/2013


Any help is appreciated.

Regards,

Sanjay


 


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>