%@ LANGUAGE="VBSCRIPT" %>
<%
dim username
username = session("username")
if((""+username) = "undefined") then
username = null
if(username=null) OR (username="") then
Response.Redirect("login_ind11.asp? dest=sellprod.asp")
dim message
dim conn = Server.CreateObject("ADODB.Connection")
dim recordSet = Server.CreateObject("ADODB.RecordSet")
dim prodSet = Server.CreateObject("ADODB.RecordSet")
conn.open("DSN=asp_database")
recordSet.Open("select * from products1",conn
,adOpenKeyset,adLockOptimistic
,adCmdText);
recordSet.AddNew()
id = Request.Form("id")
if((""+id) == "undefined")then id = null
prodSet.Open("select * from products1 where id='"+id+"';",conn
,adOpenKeyset,adLockOptimistic
,adCmdText);
if(prodSet.EOF==false) then
Response.Write("
Specify Some Other Prod_ID")
else
prodSet.Close()
recordSet("id")=id
if((Not id = null)&&(Not (""+id)=""))then
sname = ""+Request.Form("prodName")
if((sname = "undefined")OR(sname=""))then sname = null
recordSet("sname")=sname
desc = ""+Request.Form("description")
if((desc== "undefined")OR(desc==""))then desc = null
recordSet("desc")=desc
lDesc = ""+Request.Form("longDescription")
if((lDesc = "undefined")OR(lDesc="")) then lDesc = null
recordSet("lDesc")=lDesc
squant = ""+Request.Form("quantity")
if(( squant = "undefined")OR( squant="")) then squant = null
recordSet("squant")=squant
sprice = ""+Request.Form("price")
if((sprice = "undefined")OR(sprice="")) then sprice = null
recordSet("sprice")=sprice
recordSet("userid")=username
recordSet("flag")="Yes"
if((sname==null)||(desc==null)||(id==null)
||(sprice==null)||(lDesc==null)||(squant==null))
{
message = "Please complete all of the fields.";
}
else
{
recordSet.Update()
Response.Write("")
Response.Write("Record Successfully Added")
Response.Write("
")
}
}
recordSet.ReSync()
recordSet.MoveFirst()
}
%>