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
|