 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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
|
|
|
|

August 2nd, 2005, 09:17 AM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
|
|
Insert query problem. -- Solved
Hi All,
I am using an insert query, viz.
objConn.Execute ("insert into empmaster values(" & Request.Form("empid") & ",'"& Request.Form("fname") & "','"& Request.Form("lname") & "',#"& Request.Form("doj") & "#,#"& Request.Form("dob") & "#,'"& Request.Form("mobile") & "','"& Request.Form("phoneno") & "','"& Request.Form("email") & "','1'," & Request.Form("TeamList") & ",'"& Request.Form("designation") & "','password','" & Request.Form("rollno") & "'," & Request.Form("Manger") & ",#" & Request.Form("Ldate") & "#" & ")")
Now problem comes when some values are left blank, i.e. say doj or dob, it give error in that case, what if I want to permit the as blank?
Thanks in advance.:)
Rupen Anjaria.
We CAN'T avoid problems, but of course can solve it.
|
|

August 2nd, 2005, 02:27 PM
|
|
Authorized User
|
|
Join Date: Jul 2005
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Check the field in your database to see if it allows zero length
|
|

August 2nd, 2005, 06:06 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
DO as g2000 has said. When you say it gives an error, what error would be helpfull. IMO if you do not need to address a field, dont. Are you aware you can set no nulls and a default value?
Wind is your friend
Matt
|
|

August 2nd, 2005, 11:45 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try to insert like this.
set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="....."
cn.Open
isql1="insert into emp (empno,name,dept) values ("
isql2="'" & empno & "',"
isql3="'" & name & "',"
isql4="'" & dept & "')"
sql=isql1+isql2+isql3+isql4
cn.Execute sql
it will more easy.
for blank record, ie.
if Isdate(date_Recd) then
isql3="'" & date_recd & "',"
else
isql3="NULL,"
end if
Your coding may be some syntax error.
Mateen
|
|

August 3rd, 2005, 07:01 AM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 352
Thanks: 14
Thanked 0 Times in 0 Posts
|
|
Hi All,
I have set to allow zero leng in db. or say it is allowing null in db.
Mateen: Your solution is worknig fine.
Thanks..
Rupen Anjaria.
We CAN'T avoid problems, but can solve it.
|
|

May 15th, 2007, 08:59 AM
|
|
Registered User
|
|
Join Date: May 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
u can create a function which will convert the blank values to zero
|
|
 |