0

hi experts
i m facing a problem ,
i m using these code for inserting data, but showing error
The Conversion of the char data type to a date time resulted in an out-of-rang date time value . The Statement Has been terminated

Their is "ro_date" is datetime type field ins sql-server

Try
            cmd.CommandText = "insert into ro_entry (ro_date) values ('" & DateTimePicker1.Value & " ')"

            cn.Open()
            cmd.ExecuteNonQuery()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            cn.Close()
            cmd.Parameters.Clear()

        End Try
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by tanvirahmad
0

that easy..I think u should click the properties and check the time range; check the max & min date, and ensure that the datetime format is the same with the SQL format... :) this error appeared if u picked the date that is not in the range of ur calendar... gud luck for it! ;)

0

hi addilla
i checked min and max data rang min is 01/01/1900 and max is 31/12/9998 or i use "short" datetimepicker format
but it's show error

Edited by tanvirahmad: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.