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
|