WELL I GOT A DEPARTMENT AND PRODUCT PAGE. I NEED TO PASS DEPTID AS A PARAMETER VALUE TO A STORE PROCEDURE AND RETRIEVE THE DEPARTMENTS. wITH THAT PARAMETER VALUE I NEED TO GET THE RELEVANT PRODUCTS FROM A TABLE CALLED DEPTPRODUCTS.
I AM ABLE TO PASS VALUES ONE BY ONE AS A PARAMETER. IS THERE ANY WAYS TO ACCOMPLISH THIS TASK EASIER. KINDLY PROVIDE THE CODE FOR THAT ?
HERE IS MY CODE.
THANKS AND REGDS
KASI VISWANATHAN
---->>
<%@ Language=VBScript %>
<!-- #include file="adovbs.inc" -->
<!-- #include file="header.asp" -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<!-- Products.asp - This page displays the products in a department -->
-->
<%
' Create an ADO connection
Set objconn = server.createobject("ADODB.connection"
set objcmd = server.createobject("ADODB.Command"
'Create an recordset
set rsdepartment = server.createobject("ADODB.recordset"
'open the connection using
objconn.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs"
If objConn.State = adStateOpen Then
str = "select * from department"
set rsdepartment = objconn.execute(str)
'response.write rsdepartment
Set objCmd.ActiveConnection = objconn
objCmd.CommandText = "sp_retrievedept"
objCmd.CommandType = adCmdStoredProc
objCmd.Parameters.Append objcmd.CreateParameter("iddepartment", _
adInteger,adParaminput)
objcmd.Parameters("iddepartment".Value = 2
set rsdepartment = objcmd.Execute
objcmd.parameters.refresh
'rsdepartment.Requery(adasyncexecute)
'intparamavail = objconn.Properties(" In Parameter Availability"
' If parameter not available until recordset is closed
if intparamavail = 2 then
'rsdepartment.Close
end if
'strinparam = objcmd.Parameters("input_param"
Response.Write(request.querystring("iddepartment")
Response.Write(Request.querystring("chrdeptname")
Response.Write(Request.QueryString("chrdeptimage")
txtdescription = rsdepartment("txtdeptdesc"
txtdeptname = rsdepartment("chrdeptname"
chrdeptimage = rsdepartment("chrdeptimage"
' Store the ID of the department being referenced in
' the lastiddept session variable. This will allow us
' to build a link to the basket back to the department
' for further shopping.
session("Lastiddept" = request("iddepartment"
else
For Each objErr In objConn.Errors
Debug.Print objErr.Description
Next
End If
' Set objCmd = Nothing
' objConn.Close
'Set objConn = Nothing
'Retrieve the product information
'Response.Write iddepartment
'
'Display all errors
%>
<CENTER>
<Img src="HLPCD.GIF"<%=chrdeptimage%>" align="middle">
<%=txtdeptname%><FONT SIZE="4"><B></b></font><BR><BR>
</CENTER>
<!-- Display the description -->
<%=txtdescription%> Select a product :<BR><BR>
<%
'create an ADODB connection
set dbproducts = server.createobject("ADODB.Connection"
'create an record set
set obcmd = server.createobject("ADODB.Command"
set rsproducts = server.createobject("ADODB.recordset"
'Open the connection
dbproducts.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs"
str ="Select * from products"
set rsproducts=dbproducts.Execute(str)
Set obCmd.ActiveConnection = objconn
obCmd.CommandText = "sp_retrievedeptproducts"
obCmd.CommandType = adCmdStoredProc
obCmd.Parameters.Append obcmd.CreateParameter("iddept", _
adInteger,adParaminput)
obcmd.Parameters("iddept".Value = 1
set rsproducts = obcmd.Execute
obcmd.parameters.refresh
'intparamavail = objconn.Properties(" In Parameter Availability"
' If parameter not available until recordset is closed
if intparamavail = 1 then
rsproducts.Close
end if
' We are going to rotate the images from left to right
Flag = 0
'Loop through the products recorset
do until rsproducts.EOF
'Retrieve the product info to be displayed
chrproductname = rsproducts("chrproductname"
chrproductimage = rsproducts("chrproductimage"
idproduct = rsproducts("idproduct"
' Check the display flag. We will rotate the product
'images from left to right
If flag = 0 then
' set the flag
flag = 1
%>
<!-- Build the link to the product information -->
<a href="product.asp?idproduct=<%=idproduct%>">
<img src="images/products/sm_<%=chrproductimage%>"
<%=chrproductname%></a><BR><BR>
<% else %>
<!-- Build the link to the product information -->
<a href="product.asp?idproduct=<%=idproduct%>">
<%=chrproductname%>
<img src="hot.gif"/products/sm_<%=chrproductimage%>"
align="middle" border="0"></a><BR><BR>
<%
'Reset the flag
flag = 0
end if
'move to the next row
rsproducts.movenext
loop
%>
<!-- #include file="footer.asp" -->
</BODY>
</HTML>
-->>
I AM ABLE TO PASS VALUES ONE BY ONE AS A PARAMETER. IS THERE ANY WAYS TO ACCOMPLISH THIS TASK EASIER. KINDLY PROVIDE THE CODE FOR THAT ?
HERE IS MY CODE.
THANKS AND REGDS
KASI VISWANATHAN
---->>
<%@ Language=VBScript %>
<!-- #include file="adovbs.inc" -->
<!-- #include file="header.asp" -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<!-- Products.asp - This page displays the products in a department -->
-->
<%
' Create an ADO connection
Set objconn = server.createobject("ADODB.connection"
set objcmd = server.createobject("ADODB.Command"
'Create an recordset
set rsdepartment = server.createobject("ADODB.recordset"
'open the connection using
objconn.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs"
If objConn.State = adStateOpen Then
str = "select * from department"
set rsdepartment = objconn.execute(str)
'response.write rsdepartment
Set objCmd.ActiveConnection = objconn
objCmd.CommandText = "sp_retrievedept"
objCmd.CommandType = adCmdStoredProc
objCmd.Parameters.Append objcmd.CreateParameter("iddepartment", _
adInteger,adParaminput)
objcmd.Parameters("iddepartment".Value = 2
set rsdepartment = objcmd.Execute
objcmd.parameters.refresh
'rsdepartment.Requery(adasyncexecute)
'intparamavail = objconn.Properties(" In Parameter Availability"
' If parameter not available until recordset is closed
if intparamavail = 2 then
'rsdepartment.Close
end if
'strinparam = objcmd.Parameters("input_param"
Response.Write(request.querystring("iddepartment")
Response.Write(Request.querystring("chrdeptname")
Response.Write(Request.QueryString("chrdeptimage")
txtdescription = rsdepartment("txtdeptdesc"
txtdeptname = rsdepartment("chrdeptname"
chrdeptimage = rsdepartment("chrdeptimage"
' Store the ID of the department being referenced in
' the lastiddept session variable. This will allow us
' to build a link to the basket back to the department
' for further shopping.
session("Lastiddept" = request("iddepartment"
else
For Each objErr In objConn.Errors
Debug.Print objErr.Description
Next
End If
' Set objCmd = Nothing
' objConn.Close
'Set objConn = Nothing
'Retrieve the product information
'Response.Write iddepartment
'
'Display all errors
%>
<CENTER>
<Img src="HLPCD.GIF"<%=chrdeptimage%>" align="middle">
<%=txtdeptname%><FONT SIZE="4"><B></b></font><BR><BR>
</CENTER>
<!-- Display the description -->
<%=txtdescription%> Select a product :<BR><BR>
<%
'create an ADODB connection
set dbproducts = server.createobject("ADODB.Connection"
'create an record set
set obcmd = server.createobject("ADODB.Command"
set rsproducts = server.createobject("ADODB.recordset"
'Open the connection
dbproducts.open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs"
str ="Select * from products"
set rsproducts=dbproducts.Execute(str)
Set obCmd.ActiveConnection = objconn
obCmd.CommandText = "sp_retrievedeptproducts"
obCmd.CommandType = adCmdStoredProc
obCmd.Parameters.Append obcmd.CreateParameter("iddept", _
adInteger,adParaminput)
obcmd.Parameters("iddept".Value = 1
set rsproducts = obcmd.Execute
obcmd.parameters.refresh
'intparamavail = objconn.Properties(" In Parameter Availability"
' If parameter not available until recordset is closed
if intparamavail = 1 then
rsproducts.Close
end if
' We are going to rotate the images from left to right
Flag = 0
'Loop through the products recorset
do until rsproducts.EOF
'Retrieve the product info to be displayed
chrproductname = rsproducts("chrproductname"
chrproductimage = rsproducts("chrproductimage"
idproduct = rsproducts("idproduct"
' Check the display flag. We will rotate the product
'images from left to right
If flag = 0 then
' set the flag
flag = 1
%>
<!-- Build the link to the product information -->
<a href="product.asp?idproduct=<%=idproduct%>">
<img src="images/products/sm_<%=chrproductimage%>"
<%=chrproductname%></a><BR><BR>
<% else %>
<!-- Build the link to the product information -->
<a href="product.asp?idproduct=<%=idproduct%>">
<%=chrproductname%>
<img src="hot.gif"/products/sm_<%=chrproductimage%>"
align="middle" border="0"></a><BR><BR>
<%
'Reset the flag
flag = 0
end if
'move to the next row
rsproducts.movenext
loop
%>
<!-- #include file="footer.asp" -->
</BODY>
</HTML>
-->>