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

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! ;)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.