ASP Syntax Question??

P

Patty-O

Good day,

I'm very new to ASP and programming in general and I'm not sure if this is
the correct place for this question so I offer my apologies in advance.

I'm creating a press release page with Dreamweaver in ASP for a client. I've
created a small Access database to contain the information (Headline, Main
Story). I've also created 3 text fields (pic1, pic2, pic3) in the database to
store file pahtways to image files that the customer may like to include in
each new press release since Access cannot store images directly.

Dreamweaver generates an expression to write the contents of these fields,
text of course, into the HTML. To render the image I simply wrap the
dreamweaver expression in the IMG tag. Ex: <img src="<%DREAMWEAVER
EXPRESSION%>" /> and it works fine.

Now for the problem...

In most instances I would anticipate that only "pic1" field will contain
data and I have created two additional fields for the rare occassion when a
second or third image will be used. As such, I'd like to prevent the opening
and closing img tags from being written if the field they enclose contains no
data. To accomplish this I've done the following:

<%

Dim, pic1, pic2, pic3

pic1 = <%DREAMWEAVER EXPRESSION FOR PIC1 FIELD%>
pic2 = <%DREAMWEAVER EXPRESSION FOR PIC2 FIELD%>
pic3 = <%DREAMWEAVER EXPRESSION FOR PIC3 FIELD%>

If pic1 <> "null" Then
Response.Write ("<img src="pic1" />")

%>

As I said, I am very new to this sort of thing but as far as going by some
of the textbooks and other material I've read this look like a valid
expression to me.

However, testing on my local machine indicates internal server error. I'm
thinking that all the quotation marks are causing problems.

Is there something I'm overlooking regarding syntax? Bear in mind the
quotation marks around the file pathway/filename (pic1) are required.

Any help would be greatly appreciated.

Best regards,

Pat
 
G

Giles

pic1 = <%DREAMWEAVER EXPRESSION FOR PIC1 FIELD%>
pic2 = <%DREAMWEAVER EXPRESSION FOR PIC2 FIELD%>
pic3 = <%DREAMWEAVER EXPRESSION FOR PIC3 FIELD%>

If pic1 <> "null" Then
Response.Write ("<img src="pic1" />")

Try
If not IsNull(pic1) then ...

Giles
 

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
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top