A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int
column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB"
(datetime). Now when I am trying to add a new row using the following
INSERT statement:
sqlDapter.Inser tCommand = New SqlCommand
sqlDapter.Inser tCommand.Comman dText = "INSERT INTO UserDetailss
VALUES('bobby', 'simpson','" & Now() & "')"
sqlDapter.Inser tCommand.Connec tion = sqlConn
sqlDapter.Updat e(dSet, "UserDetail s")
'Response.Write ("INSERT INTO UserDetailss VALUES('bobby', 'simpson','" &
Now() & "')"
the following error gets generated pointing to the Update line:
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
I even tried using the different DateTime Format functions but none of
them work. WHere am I going wrong?
Thanks
Arpan 4 8672
DateTime.Now is a DateTime value, not a string. Try using
DateTime.Now.To String()
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Surgery
Orange you bland I stopped splaying bananas?
"Arpan" <ar******@hotma il.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
>A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int
column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB"
(datetime). Now when I am trying to add a new row using the following
INSERT statement:
sqlDapter.Inser tCommand = New SqlCommand
sqlDapter.Inser tCommand.Comman dText = "INSERT INTO UserDetailss
VALUES('bobby', 'simpson','" & Now() & "')"
sqlDapter.Inser tCommand.Connec tion = sqlConn
sqlDapter.Updat e(dSet, "UserDetail s")
'Response.Write ("INSERT INTO UserDetailss VALUES('bobby', 'simpson','" &
Now() & "')"
the following error gets generated pointing to the Update line:
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
I even tried using the different DateTime Format functions but none of
them work. WHere am I going wrong?
Thanks
Arpan
DateTime.Now is a DateTime value, not a string. Try using
DateTime.Now.To String()
Kevin, DateTime.Now.To String() still generates the same out-of-range
error & why wouldn't it? The data type of the column named "DOB" in the
DB table (& hence in the DataSet as well) is "datetime" which means SQL
Server is expecting a datetime record in that column; so converting it
to string - how will that work?
Please correct me if I am wrong.
Thanks,
Regards,
Arpan
Kevin Spencer wrote:
DateTime.Now is a DateTime value, not a string. Try using
DateTime.Now.To String()
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Surgery
Orange you bland I stopped splaying bananas?
"Arpan" <ar******@hotma il.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int
column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB"
(datetime). Now when I am trying to add a new row using the following
INSERT statement:
sqlDapter.Inser tCommand = New SqlCommand
sqlDapter.Inser tCommand.Comman dText = "INSERT INTO UserDetailss
VALUES('bobby', 'simpson','" & Now() & "')"
sqlDapter.Inser tCommand.Connec tion = sqlConn
sqlDapter.Updat e(dSet, "UserDetail s")
'Response.Write ("INSERT INTO UserDetailss VALUES('bobby', 'simpson','" &
Now() & "')"
the following error gets generated pointing to the Update line:
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
I even tried using the different DateTime Format functions but none of
them work. WHere am I going wrong?
Thanks
Arpan
Is the date format whch you are trying to insert the same
format as your SQL Server's default date format ?
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Arpan" <ar******@hotma il.comwrote in message
news:11******** **************@ 74g2000cwt.goog legroups.com...
>DateTime.Now is a DateTime value, not a string. Try using DateTime.Now.T oString()
Kevin, DateTime.Now.To String() still generates the same out-of-range
error & why wouldn't it? The data type of the column named "DOB" in the
DB table (& hence in the DataSet as well) is "datetime" which means SQL
Server is expecting a datetime record in that column; so converting it
to string - how will that work?
Please correct me if I am wrong.
Thanks,
Regards,
Arpan
Kevin Spencer wrote:
>DateTime.Now is a DateTime value, not a string. Try using DateTime.Now.T oString()
-- HTH,
Kevin Spencer Microsoft MVP Chicken Salad Surgery
Orange you bland I stopped splaying bananas?
"Arpan" <ar******@hotma il.comwrote in message news:11******* *************** @b28g2000cwb.go oglegroups.com. ..
>A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int
column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB"
(datetime). Now when I am trying to add a new row using the following
INSERT statement:
sqlDapter.Inser tCommand = New SqlCommand
sqlDapter.Inser tCommand.Comman dText = "INSERT INTO UserDetailss
VALUES('bobby', 'simpson','" & Now() & "')"
sqlDapter.Inser tCommand.Connec tion = sqlConn
sqlDapter.Updat e(dSet, "UserDetail s")
'Response.Write ("INSERT INTO UserDetailss VALUES('bobby', 'simpson','" &
Now() & "')"
the following error gets generated pointing to the Update line:
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
I even tried using the different DateTime Format functions but none of
them work. WHere am I going wrong?
Thanks
Arpan
Is the date format whch you are trying to insert the same
format as your SQL Server's default date format ?
Juan, the datetime records already present in SQL Server look like
this:
19/08/2006 11:17:45 AM
& when I do a
Response.Write( Now())
the output is exactly the same i.e.
19/08/2006 11:17:45 AM
So I guess they are the same, aren't they?
Thanks,
Regards,
Arpan
Juan T. Llibre wrote:
Is the date format whch you are trying to insert the same
format as your SQL Server's default date format ?
Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Arpan" <ar******@hotma il.comwrote in message
news:11******** **************@ 74g2000cwt.goog legroups.com...
DateTime.Now is a DateTime value, not a string. Try using
DateTime.Now.To String()
Kevin, DateTime.Now.To String() still generates the same out-of-range
error & why wouldn't it? The data type of the column named "DOB" in the
DB table (& hence in the DataSet as well) is "datetime" which means SQL
Server is expecting a datetime record in that column; so converting it
to string - how will that work?
Please correct me if I am wrong.
Thanks,
Regards,
Arpan
Kevin Spencer wrote:
DateTime.Now is a DateTime value, not a string. Try using
DateTime.Now.To String()
--
HTH,
Kevin Spencer
Microsoft MVP
Chicken Salad Surgery
Orange you bland I stopped splaying bananas?
"Arpan" <ar******@hotma il.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
A SQL Server 2005 DB table has 4 columns namely "ID" (IDENTITY int
column), "FirstName" (varchar(50)), "LastName" (varchar(50)) & "DOB"
(datetime). Now when I am trying to add a new row using the following
INSERT statement:
sqlDapter.Inser tCommand = New SqlCommand
sqlDapter.Inser tCommand.Comman dText = "INSERT INTO UserDetailss
VALUES('bobby', 'simpson','" & Now() & "')"
sqlDapter.Inser tCommand.Connec tion = sqlConn
sqlDapter.Updat e(dSet, "UserDetail s")
'Response.Write ("INSERT INTO UserDetailss VALUES('bobby', 'simpson','" &
Now() & "')"
the following error gets generated pointing to the Update line:
The conversion of a char data type to a datetime data type resulted in
an out-of-range datetime value.
I even tried using the different DateTime Format functions but none of
them work. WHere am I going wrong?
Thanks
Arpan
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: george |
last post by:
This is like the bug from hell. It is kind of hard to explain, so
please bear with me.
Background Info: SQL Server 7.0, on an NT box, Active Server pages
with Javascript, using ADO objects.
I'm inserting simple records into a table. But one insert command is
placing 2 or 3 records into the table. The 'extra' records, have the
same data as the previous insert incident, (except for the timestamp).
|
by: Martin |
last post by:
Hello,
I'm new with triggers and I can not find any good example on how to
do the following:
I have two tables WO and PM with the following fields:
WO.WONUM, VARCHAR(10)
WO.PMNUM, VARCHAR(10)
WO.PROBLEMCODE, VARCHAR(8)
|
by: trint |
last post by:
This:
string strSQL2 = "INSERT INTO tblTravelDetailMember(memberId, " +
" TravelDetailUplineId, " +
" rankId, " +
" TravelDetailId, " +
" CreatedDateTime, " +
" Operator) " +
"VALUES ('" + insertString2 + "', " +
" '" + insertString3 + "', " +
|
by: Arek |
last post by:
Hey,
I am inserting values in the table:
Dim sqlcomm1 As SqlCommand = New SqlCommand("INSERT INTO tblTasks
(idTask, outdate) VALUES ('" & IDTask.text & "','" & txtOutdate.Text &
"')", conn)
sqlcomm1.ExecuteNonQuery()
Query is working fine if there is value in the txtOutDate, but if user
leaves the field txtOutdate empty, system insert date 1900-01-01. I want
|
by: NathanV |
last post by:
I have created a class and stored procedure to insert records into a table.
The insert works but only the first character of the "Title" and "Body"
fields are added. I have traced up to the point of executing the sproc and
the string values are intact up to this point. Below is my code for the
SPROC and the insert method of the class:
.........................................................................................
Sproc...
| |
by: Tim::.. |
last post by:
Can someone please tell me why I keep getting the following error from the
code below!
Error: INSERT statement conflicted with COLUMN FOREIGN KEY constraint
'FK_tblOfficePageContent_tblPageContent'. The conflict occurred in database
'CPNCMS', table 'tblPageContent', column 'pageID'. The statement has been
terminated.
I cant seem to see why I keep getting an error when I do the insert!
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am
using MS-Access 2000 database table for this app. Note that the
datatype of all the fields mentioned above are Text. Apart from the
above columns, there's another column in the DB table named
'RegDateTime' whose datatype is Date/Time which is...
|
by: Martin Z |
last post by:
INSERT INTO dbo.Transmission
(TransmissionDate, TransmissionDirection,
Filename, TransmittedData)
VALUES
(@TransmissionDate,@TransmissionDirection,@Filename,@TransmittedData);
SELECT @retVal = SCOPE_IDENTITY();
Pretty simple. There is an additional TransmissionID column that is
an autonumber and primary key. @retVal is always null in my table
adapter function, where I'm setting @retval (in the Parameters
|
by: gpspocket |
last post by:
help me -CURSOR backward insert from End Date > to Start Date
how to insert dates from end to start
like this
SELECT 111111,1,CONVERT(DATETIME, '17/03/2008', 103), CONVERT(DATETIME, '01/03/2008'
i explain i have stord prosege that create mod cycle shift pattern
and it working ok
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |