I am trying (unsuccessfully) to get an answer to thie question posted here:http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_21805764.html
I have a table called ModPicCats, and it is structured like this:
I use the following stored procedure and ASP to display a "Breadcrumb" navigation from this table.
CREATE Procedure gcDirNav(@PageID nvarchar(255) = 0,@Delimiter varchar(5) = ' > ') As
Declare @BreadCrumb nvarchar(4000)
Set @BreadCrumb = ''
WHILE @PageID > 0
If (Select gCat From ModPicCats Where [gcID] = @PageID) <> 'Top'
Set @BreadCrumb = (Select '<a href="piccats.asp?pCat=' + @PageID + '">' + gCat + '</a>' From ModPicCats Where [gcID] = @PageID) + @Delimiter + @BreadCrumb
Set @PageID = (Select ParentID From ModPicCats Where [gcID] = @PageID) -- This iterates round until we get to the top (lcID = 0)
Set @BreadCrumb = '<a href="piccats.asp?pCat=0">
Top</a>' + @Delimiter + @BreadCrumb
Set @BreadCrumb = Left(@BreadCrumb,Len(@Brea
dCrumb) - Len(@Delimiter))
Select @BreadCrumb As BreadCrumb
the ASP Code I use to display the nav is as follows:
if pCat = "" OR ISNULL(pCat) OR pCat = "0" then
pCat = 0
pCat = pCat
Set cnNav = createobject("ADODB.Connec
write cnNav.Execute ("Execute gcDirNav " & Cstr(pCat) & ",' > '").Fields("Breadcrumb").V
Set cnNav = Nothing
what I'd like to do is make the stored procedure dynamic. So all I'd have to do is pass the table name (the other tables will be structured the exact same as above), and the correct URL. However I do not know how.
Can anyone help?