View Single Post
  #1 (permalink)  
Old September 3rd, 2004, 03:59 PM
reidcor reidcor is offline
Authorized User
 
Join Date: Jul 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default E-Comm Product Catalog Search

Hi,
I'm trying to do a different method of searching a catalog
and producing a dataList. Instead of clicking departments
or categories and getting autopostback, I want to have two
(or more) dropdownlists to choose parameters, then begin
a search by clicking a search button. So autopostback on
the dropdownlists is set to "False".

My page loads, shows the populated ddl's, and I have the
initial dataList set to visible=False(don't want to show
all items before a search is initiated.

My problem is with the search_click sub. Here it is:

Protected Sub Search_Click(ByVal Sender As Object, ByVal E As
                           EventArgs)

            Dim ProductId As Integer
            Dim ProdClassId As String = Request.Params("ProdClassId")
            Dim PropReqCode As String = Request.Params("PropReqCode")

            If Not (ProdClassId) Is Nothing Then

                ClassDropDown.SelectedIndex =
                ClassDropDown.Items.IndexOf( _
                ClassDropDown.Items.FindByValue(ProdClassId))

            End If

            If Not (PropReqCode) Is Nothing Then
                PropertyRequirementDropDown.SelectedIndex =
                PropertyRequirementDropDown.Items.IndexOf( _
                PropertyRequirementDropDown.Items.FindByValue
                (PropReqCode))

            End If

            Dim CatalogListingsDataSet As DataSet = New _
            Business.ProductCatalog().GetProducts(ProdClassId,
            PropReqCode)
            CatalogListings.DataSource = CatalogListingsDataSet
            CatalogListings.DataBind()

            CatalogListings.Visible = True

        End Sub

...right now, this gives me this error message:

Error

---------------------------------------------------------------------
An unexpected error has occurred on this page.The system administrators have been notified.

The error occurred in:

http://localhost/VendorScape/WebModu...x?ProductId=11

Error Message:

Procedure or function sp_Vendors_GetProducts has too many arguments specified.

Error Stack:

System.Data.SqlClient.SqlException: Procedure or function sp_Vendors_GetProducts has too many arguments specified.

   at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.System.Data.IDbCo mmand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
   at FYRM.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters, String tableName) in C:\FYRM\VendorScape\Webmodules\Core\DbObject.vb:li ne 103
   at FYRM.WebModules.Vendors.Data.ProductCatalog.GetPro ducts(Int32 ProductId, String ProductName, String ProductDescription, Int32 ProdClassId, String VendorCompanyName, String ImageUrl, Int32 PropReqCode, String ContactInfo) in C:\FYRM\VendorScape\WebModules\Vendors\Vendors.Dat a\ProductCatalog.vb:line 66
   at FYRM.WebModules.Vendors.Business.ProductCatalog.Ge tProducts(Int32 ProdClassId, Int32 PropReqCode) in C:\FYRM\VendorScape\WebModules\Vendors\Vendors.Bus iness\ProductCatalog.vb:line 68
   at FYRM.WebModules.Vendors.Web.ProductCatalog.Search_ Click(Object Sender, EventArgs E) in C:\FYRM\VendorScape\WebModules\Vendors\ProductCata log.aspx.vb:line 77
   at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
   at System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
   at System.Web.UI.Page.ProcessRequestMain()

Here is the stored proc:

ALTER PROCEDURE sp_Vendors_GetProducts
@ProdClassId Int,
@PropReqCode Int
AS
SELECT ProductId, ProductName, ProductDescription, ProdClassId, VendorCompanyName, ImageUrl, PropReqCode, ContactInfo FROM Vendors_ProductsTable WHERE ProdClassId = @ProdClassId AND PropReqCode = @PropReqCode

- - - - - - - - -
if anyone can see where I might alter this code to fix it, plz
let me know. I have looked around forums and sites for an example
of a button to handle multiple dropdownlist controls, but can't
find one. almost all examples of catalog searches feature drop-
downlists that each do autopostback.
Thx,




Reid C.
__________________
Reid C.