syntax issues

S

shank

I have the following. I've tried swapping the " and ' in and around and
can't get the right syntax.

<%
varA = "<a href=" & "article.asp?id=" & (rsHead.Fields.Item("ID").Value) &
">Article</a>"
%>

My end results are: Type mismatch: '[string: "<a href=article.asp?"]'

Can someone lend a thought?
thanks
 
D

dlbjr

<%
varA = "<a href='article.asp?id=" & rsHead.Fields.Item("ID").Value & "'>Article</a>"
%>

'dlbjr
'Pleading sagacious indoctrination!
 
D

dlbjr

<%
strData = rsHead.Fields.Item("ID").Value
Response.Write strData & "<BR>"
Response.Flush
If Len(strData) > 0 Then
varA = "<a href='article.asp?id=" & rsHead.Fields.Item("ID").Value & "'>Article</a>"
End If
%>

This will let you see what is returned
 
R

Ray Costanzo [MVP]

Did you copy and paste that from your ASP file? And are you that that is
the line in error? I don't see anything syntactically incorrect.

Try:

<%
varA = "<a href=""article.asp?id=" & rsHead.Fields.Item("ID").Value &
""">Article</a>"
%>

Ray at home
 
S

StephenMcC

Try loosing the db field and build the string with a dummy value, also all
variables in ASP are variants so you may need to perform a CSTR on the db
field, ie:

<%
Dim varA
'..With dummy value
varA = "<a href='article.asp?id=1'>Article</a>"

'..Then maybe
varA = "<a href='article.asp?id=" & CStr("" &
rsHead.Fields.Item("ID").Value) & "'>Article</a>"
%>

Hope this is helpful,

Stephen.

..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top