<%
    function updateSql(db,query)
	dim con
	err.clear
	set con=server.createObject("adodb.connection")
	con.open db
	con.execute query
	con.close
	set con=nothing
	response.write err.description
    end function
    '----------------------------
    id=request("id")
    if id="" then id=0
    
    if cint(request("txtType"))=0 then
	updatesql Application("Product"),"insert into cat (name,parent) values('" & request("txtName") & "'," & request("id") & ")"
    else
	updatesql Application("Product"),"insert into items  (cat_id,name,url) values(" & request("id") & ",'" & request("txtName") & "','product.asp')"
    end if    
    
    response.redirect("admin.asp?id=" & id)
%>

