ASP Syntax Question??

Discussion in 'ASP General' started by Patty-O, Jun 3, 2005.

  1. Patty-O

    Patty-O Guest

    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
    Patty-O, Jun 3, 2005
    #1
    1. Advertising

  2. Patty-O

    Giles Guest

    "Patty-O" <> wrote


    > 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
    Giles, Jun 4, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gabriele renzi
    Replies:
    2
    Views:
    200
    gabriele renzi
    Dec 31, 2005
  2. Ken Bloom
    Replies:
    3
    Views:
    203
  3. Good Night Moon
    Replies:
    9
    Views:
    275
    Rick DeNatale
    Jul 25, 2007
  4. Jacob Grover
    Replies:
    5
    Views:
    307
    Jacob Grover
    Jul 18, 2008
  5. Mark Richards
    Replies:
    3
    Views:
    309
    Tad McClellan
    Nov 18, 2007
Loading...

Share This Page