Wrox Programmer Forums
|
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
 
Old April 16th, 2005, 07:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default if then else condition

I use following if then else condition in asp.
problem is that some it insert the record into table and
some time not insert records.
what is the problem in insert query ?

check dated2 exit in table or not, if not exit then insert records
run following insert query with where clasue.


projno=Request.Form("projno")
dated1=Request.Form("dated1")
dated2=Request.Form("dated2")

set cn=server.CreateObject("adodb.connection")
cn.ConnectionString="" // connection string
cn.Open

ssql="select dated from bh where dated='"& dated2 &"'"

set rs=cn.Execute(ssql)

if rs.eof=false then

Response.Redirect("http://dcilweb/tabulation/bmhours/addbmhnm.asp?msg=Date+Already+Exit")

else

isql1="insert BH (empno,projno,BH,Dated,USERID) Select empno,'"& projno &"',BH,'"& dated2 &"', userid From BH where Dated = '"& dated1 &"'"

on error resume next
cn.Execute isql1
if err.number=0 then
Response.Redirect("addbmhnm3.asp")
else
Response.Redirect("addbmhnm4.asp")
end if
end if


regards.

Mateen







Similar Threads
Thread Thread Starter Forum Replies Last Post
or condition kgoldvas XSLT 1 July 31st, 2007 03:44 AM
where condition...? mnr555 Crystal Reports 0 June 18th, 2006 05:32 PM
Please check my where condition mat41 SQL Language 4 May 26th, 2006 08:52 AM
Condition mateenmohd SQL Server 2000 6 May 6th, 2004 03:49 AM





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