Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic meta tags not being displayed

Status
Not open for further replies.

campdw

Technical User
Mar 15, 2005
4
GB
Hello

I am trying to display dynamic meta tags throughout my website using dreamweaver to help write the code, but I am unable to get the data to display anything. Can someone take a look at my ASP statement?

##########################################################
<%
Dim rsMetaKeywords__varCatCode
rsMetaKeywords__varCatCode = ""
If (sCc <> "") Then
rsMetaKeywords__varCatCode = sCc
End If
%>
<%
Dim rsMetaKeywords
Dim rsMetaKeywords_numRows

Set rsMetaKeywords = Server.CreateObject("ADODB.Recordset")
rsMetaKeywords.ActiveConnection = MM_dtor_data_STRING
rsMetaKeywords.Source = "SELECT CATEGORY, CUSTMEMO1 FROM dbo.CATEGORY WHERE CATEGORY = '" + Replace(rsMetaKeywords__varCatCode, "'", "''") + "' ORDER BY CATEGORY"
rsMetaKeywords.CursorType = 0
rsMetaKeywords.CursorLocation = 2
rsMetaKeywords.LockType = 1
rsMetaKeywords.Open()

rsMetaKeywords_numRows = 0
%>
<meta name="keywords" content="<%=(rsMetaKeywords.Fields.Item("CUSTMEMO1").Value)%>">
<meta name="description" content="<%=rsMetaKeywords__varCatCode%>">
<%
rsMetaKeywords.Close()
Set rsMetaKeywords = Nothing
%>
##########################################################

When the script runs the variable rsMetaKeywords__varCatCode is assigned a value of the category code but I think the problem lies with the rsMetaKeywords.Source part of the script. when i view the source the meta tag is blank but when i run a test conection in dreamweaver using the category code to find the data it displays. do you think it is an IIS6 setup issue or the code itselfe?

Regards
 
Perhaps your SQL statement is not what you think it should be at runtime. To check do something like this:

Before this line:
rsMetaKeywords.Open()

Insert this code:
Response.Write vbCrLf & "Source = " & rsMetaKeywords.Source & vbCrLf

 
I have added the code as you described and it is displaying the SQL statement correctly.

The SQL statment that is displayed is:

Source = SELECT CATEGORY, CUSTMEMO1 FROM dbo.CATEGORY WHERE CATEGORY = 'MEMORY_CARDS' ORDER BY CATEGORY

so do you think the problem is with the way i am asking the browser to display the information

<meta name="keywords" content="<%=(rsMetaKeywords.Fields.Item("CUSTMEMO1").Value)%>">
 
think the problem is here:

Code:
rsMetaKeywords__varCatCode = ""
If (sCc <> "") Then
rsMetaKeywords__varCatCode = sCc
End If

not sure what sCc is, and your saying if its nothing then
rsMetaKeywords__varCatCode = ""
 
sCc stands for Category Code, this is given a value when the page loads like MEMORY_CARDS. The value that it holds is correct, I know this because to double check I have put the variable <%=rsMetaKeywords__varCatCode%> in the meta description tag and it shows as MEMORY_CARDS at runtime.

So we have concluded that the connection to the database is working the SQL statement is correct and the variable being used in the SQL statement has the correct value.

I am wondering if it is a permissions issue with my local machine only allowing it to handle one record set at a time. let me know what you think.
 
if the connection is and the sql is working and your Memory_cards to show. What exactly is the problem? What are you trying to do?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top