Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2006, 06:36 PM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP insert into sql date problem

Hi people,

Got a slight problem. Im new to asp and ive been set the task to create a web front end access db back end database.

Im trying to insert values into the database but i have lots of date fields. It only seems to work when i fill in all the date fields. My code is:

sql="INSERT INTO tblProject (managerid,"
sql=sql & "salesmanid,siteid,sectorid,customername,customerl ocation,vehicleproject,typeid,a3due,a0,a1,a2,a3,a4 ,a5,a6,quoted,orderrec,comments,status)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("selmanager") & "',"
sql=sql & "'" & Request.Form("selsalesman") & "',"
sql=sql & "'" & Request.Form("selcostsite") & "',"
sql=sql & "'" & Request.Form("selsector") & "',"
sql=sql & "'" & Request.Form("txtcustomer") & "',"
sql=sql & "'" & Request.Form("txtlocation") & "',"
sql=sql & "'" & Request.Form("txtvehicle") & "',"
sql=sql & "'" & Request.Form("seltype") & "',"
sql=sql & "'" & Request.Form("txttarg") & "',"
sql=sql & "'" & Request.Form("txta0") & "',"
sql=sql & "'" & Request.Form("txta1") & "',"
sql=sql & "'" & Request.Form("txta2") & "',"
sql=sql & "'" & Request.Form("txta3") & "',"
sql=sql & "'" & Request.Form("txta4") & "',"
sql=sql & "'" & Request.Form("txta5") & "',"
sql=sql & "'" & Request.Form("txta6") & "',"
sql=sql & "'" & Request.Form("txtquote") & "',"
sql=sql & "'" & Request.Form("txtrec") & "',"
sql=sql & "'" & Request.Form("txtcomments") & "',"
sql=sql & "'" & Request.Form("selstatus") & "')"

In the database i have the date fields set to short date. I know the problem is Null values but i aint gotta clue how to fix it.

the sql looks like:
INSERT INTO tblProject (managerid,salesmanid,siteid,sectorid,customername ,customerlocation,vehicleproject,typeid,a3due,a0,a 1,a2,a3,a4,a5,a6,quoted,orderrec,comments,status) VALUES ('Fred','Bill','Burton','BS and Ceilings','test','test','test','New Business','','01/01/2005','01/01/2005','01/01/2006','01/01/2006','01/01/2006','01/01/2006','01/01/2006','01/01/2006','01/01/2006','test','Won')

Any help on this would be greatly appreciated.

Thanks

Mark
 
Old February 18th, 2006, 10:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

http://www.aspfaq.com/show.asp?id=2023





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sql Insert -- date format issue feets Access VBA 2 June 12th, 2007 12:11 PM
INSERT DATE INTO SQL SERVER prasanta2expert ASP.NET 1.0 and 1.1 Basics 1 January 4th, 2007 08:27 AM
How to insert date in Sql Server through aspx page jay4ever_2000 ASP.NET 1.0 and 1.1 Professional 4 February 20th, 2006 08:53 AM
Need help with ASP SQL Date problem bleutiger Classic ASP Professional 6 January 21st, 2005 12:41 AM
ASP SQL Date Problem Please help bleutiger Classic ASP Databases 5 January 20th, 2005 05:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.