I have an admin page to search for products to edit, but the page keeps returning the error:
Microsoft OLE DB Provider for SQL Server error '80040e14' Ambiguous column name 'prod_id'. /__admin/searchproducts.asp, line 89
I'm unsure why this error is cropping up, because the page and site is a direct copy of another website and associated MSSQL database and the search product page works on that site.
This is the code in question (not sure if it will be easy to read here though);
if request("fldSubmitted") <> "" then
if request("fldprodid") <> "" and isNumeric(request("fldprodid")) then
SQL = "select * from products where prod_id = " & cdbl(request("fldprodid"))
else
SQL = "select "
if request("showtop") <> "all" then
SQL = SQL & " top " & request("showtop") & " " & replace(replace(request("orderby")," asc","")," desc","") & ", "
end if
SQL = SQL & "prod_name, prod_id, prod_code, prod_icon, prod_thumb, prod_numViews, prod_archived"
if request("fldLabel") <> "" then SQL = SQl & ", label_name"
if request("fldCat") <> "" then SQL = SQL & ", cat_name"
if request("fldSubcat") <> "" then SQL = SQL & ", subcat_name"
SQL = SQL & " from products"
if request("fldLabel") <> "" then SQL = SQL & ", labels"
if request("fldCat") <> "" then SQL = SQL & ", categories"
if request("fldSubcat") <> "" then SQL = SQl & ", subcategories"
sql = sql & " where 1=1"
if request("fldLabel")<> "" then SQL = SQL & "and prod_label = label_id "
if request("fldCat") <> "" then SQL = SQL & "and prod_category = cat_id "
if request("fldSubcat") <> "" then SQL = SQL & "and prod_subcategory = subcat_id "
if request("fldName") <> "" then SQL = SQL & " and (prod_name like '%" & replace(request("fldName"),"'","''") & "%')"
if request("fldCode") <> "" then SQL = SQL & " and (prod_code like '%" & replace(request("fldCode"),"'","''") & "%')"
if request("fldLabel") <> "" then SQL = SQL & " and prod_label = " & request("fldLabel")
if request("fldCat") <> "" then SQL = SQL & " and prod_category = " & request("fldCat")
if request("fldSubcat") <> "" then SQL = SQL & " and prod_subcategory = " & request("fldSubcat")
if request("fldArchived") = "No" then
SQL = SQL & " and prod_archived = 0"
if request("instock") = "No" then SQL = SQL & " and prod_numleft > 0"
end if
SQL = SQL & " order by " & request("orderby")
end if