I have the following web page: -
mports System.Data.SqlClient
-
Imports System.Data
-
-
Partial Class Default2
-
Inherits System.Web.UI.Page
-
Dim opnumber As String
-
Dim exceptiondate As DateTime
-
Dim stime As DateTime
-
Dim etime As DateTime
-
Dim hours As String
-
Dim minutes As String
-
Dim exceptioncode As String
-
Dim submittedby As String
-
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
opnumber = CType(Session.Item("opnumber"), String)
-
exceptiondate = CType(Session.Item("exceptiondate"), DateTime)
-
stime = CType(Session.Item("starttime"), DateTime)
-
etime = CType(Session.Item("endtime"), DateTime)
-
hours = CType(Session.Item("hours"), String)
-
minutes = CType(Session.Item("minutes"), String)
-
exceptioncode = CType(Session.Item("exceptioncode"), String)
-
submittedby = CType(Session.Item("submittedby"), String)
-
-
opnumLabel.Text = opnumber
-
exceptdateLabel.Text = exceptiondate
-
starttimeLabel.Text = stime
-
endtimeLabel.Text = etime
-
hourdurLabel.Text = hours
-
mindurLabel.Text = minutes
-
codeLabel.Text = exceptioncode
-
approvedbyLabel.Text = submittedby
-
End Sub
-
-
Protected Sub sqlsubmitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles sqlsubmitButton.Click
-
InsertRow()
-
End Sub
-
Public Sub InsertRow()
-
Dim myConnectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxxx;"
-
-
Dim myConnection As New SqlConnection(myConnectionString)
-
Dim commandText As String = _
-
"insert into Exceptions (employeenumber, exceptiondate, starttime, endtime, duration, code, approvedby) " & _
-
"values(@employeenumber, @exceptiondate, @starttime, @endtime, @duration, @code, @approved)"
-
-
Using connection As New SqlConnection(myConnectionString)
-
Dim command As New SqlCommand(commandText, connection)
-
-
command.Parameters.AddWithValue("@employeenumber", opnumber)
-
command.Parameters.AddWithValue("@exceptiondate", exceptiondate)
-
command.Parameters.AddWithValue("@starttime", stime)
-
command.Parameters.AddWithValue("@endtime", etime)
-
command.Parameters.AddWithValue("@duration", hours & " " & minutes)
-
command.Parameters.AddWithValue("@code", exceptioncode)
-
command.Parameters.AddWithValue("@approved", submittedby)
-
-
Try
-
-
connection.Open()
-
Dim rowsAffected As Integer = command.ExecuteNonQuery()
-
-
Catch ex As Exception
-
myerrormessageLabel.Text = ex.Message
-
End Try
-
thankyouLabel.Text = "Your Data Has Been Submitted"
-
End Using
-
-
End Sub
-
-
Protected Sub cancelinputButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cancelinputButton.Click
-
Response.Redirect("Default.aspx")
-
End Sub
-
and when I try to submit my data (which is):
Op #: 8451
Exception Date: 11/15/2010
Start Time: 11:00:00 AM
End Time: 12:00:00 PM
Duration: 1 hours 0 minutes
Reason: Approved Technical Reason
Submitted By: User
to my sql server, I get the following error:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Can anyone tell me what may be causing this error?
Thank you,
Doug
1 2047 mzmishra 390
Recognized Expert Contributor
This exception comes if datetime value is null.
Check u r parameter values.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: FrodoBaggins |
last post by:
Dear Team,
Attempting to insert a record into a SQL database, using the command:
command.ExcuteNonQuery();
Get the following error message in the event log:
SQLDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999
11:59:59 PM
|
by: poppy |
last post by:
I set up my parameters in code as follows :
lTTState.startDate = Today.AddDays(-10)
lTTState.startDate = Today
lSqlCmd.Parameters.Add(New
SqlParameter("@startDate", SqlDbType.DateTime))
lSqlCmd.Parameters("@startDate").Value =
lTTState.startDate
lSqlCmd.Parameters.Add(New SqlParameter("@endDate",
SqlDbType.DateTime))
lSqlCmd.Parameters("@endDate").Value = lTTState.endDate
|
by: Paperback Writer |
last post by:
I need to insert null in a DateTime field and in the ASP.Net i got this
error:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999
11:59:59 PM.
How to accomplish that ?
--
Please, check my theSpoke:
http://www.thespoke.net/MyBlog/dgroh/MyBlog.aspx
|
by: shivavrata |
last post by:
Hi All,
I want to transfer the data form webpage to any other own application
which is running in backend.How i develop this web page. which
technology is good for this or any particular protocol i have to use
for this. Please suggest if any idea regarding data transfer.
Thanks
Shiva Vrata Anand
|
by: Mike9900 |
last post by:
Hello,
I am getting SqlDateTime overflow if I use .NET remoting on Windows XP and
Windows XP is the server where the SQL server is located at. If my computer
is Windows 2003 where the sql server is running and I use client as the
windows XP I do not get this error.
--
Mike
| |
by: lairpr |
last post by:
I am having this kind of error when trying to insert a null value;
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
bellow is my code, thanks
protected void btnAddTime_Click(object sender, EventArgs e)
{
try
{
|
by: nerd19 |
last post by:
I was wonder how i would go about limiting a length of a string that is going to be entered into a text box. An example my explain this better:
the data is coming from a barcode that reads: ABCDEF 1a2b3c
as you can see there are two sections one letter sections and one alphanumeric section. the first is only 6 characters long and then a space and then a set of 6 alphanumeric charaters. If this is being entered into a text box/combo...
|
by: baburk |
last post by:
HI
I want to pass null or ""
When I pass like that I got an error
System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Is there is any possibility to send null or ""
|
by: Peter |
last post by:
I have the following web page and I am trying to have the Field lables NOT
to wrap. It looks fine in a designer but when I run the program in a
browser the lables that have a space wrap. How do I prevent this? Also, is
there a better way to design an data entry web page without using tables,
(it's a realy paint in you know what to do that with tables), but I don't
know how to line up the fields any other way.
Thank You
|
by: jhansi xavier |
last post by:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |