Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 image problem
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  20:33:00  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
i am creating an image db script and get this error:

Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/images.asp, line 23

Response.Write("<img src=""<%=x.value
-------------------------------------^

and here is my line 23:

<table border="1" width="100%">
<tr>
<%For Each x In rs.Fields
response.write("<th>" & x.name & "</th>")
Next%>
</tr>
<%Do Until rs.EOF%>
<tr>
<%For Each x In rs.Fields%>
<td><%Response.Write("<img src=""<%=x.value%>"">")%></td>
<%Next
rs.MoveNext%>
</tr>
<%Loop
rs.close
conn.close
%>
</table>





Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 March 2002 :  20:54:44  Show Profile
Change the following line:
<td><%Response.Write("<img src=""<%=x.value%>"">")%></td>

To:
<td><img src="<%=x.value%>"></td>

Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  21:50:14  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
ok..i changed the code..and now i can display a image...but i also want to display some text with it:

<html>
<body>
<%

dim trick
dim ID
dim Skier
Dim url
dim Photog
ID=request.querystring("ID")
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "d:\html\users\newschoolskiingcom\database\images.mdb"


set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT url,Photog,Skier FROM images"
rs.Open sql,conn
%>

<table border="1" width="100%">
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td>trick:<%=trick%><br><img src="/images/<%=(x.value)%>"></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
%>
</table>

</body>
</html>

ie: trick is a value in the db..how can i display it where it says "trick:<%=trick%>"?



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 March 2002 :  22:02:57  Show Profile
Is trick a field in your images table? If so, change your sql statement to this:

sql="SELECT url,Photog,Skier,trick FROM images"

Then change your reference to trick as this:

trick: <%= rs("trick") %>

Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  22:13:31  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
it worked!!
thanks a lot Nikkol!



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 March 2002 :  22:18:30  Show Profile


Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  22:20:48  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
one more thing...
i want to be able to call the image by a variable...ie:
ID
through a querystring. now how would i make it would see the image id and get the images url?



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 March 2002 :  22:22:51  Show Profile
what are all the field names in your images table and what data types are they?

Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  22:24:18  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
Trick,url,Photog,Skier
all just the basic..i am not storing the actual image data in it..just the links to the images



Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  22:26:35  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
o..i forgot and ID



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 March 2002 :  22:27:09  Show Profile
just a note... if you were looking for a particular ID, then you could just make your sql statement:
sql="SELECT url,Photog,Skier,trick FROM images WHERE ID = " & idvalue

where idvalue could be set earlier in the page, passed through the URL's query string, submitted from a form....

Nikkol
Go to Top of Page

asp_storm
Average Member

USA
787 Posts

Posted - 13 March 2002 :  22:34:45  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
ok..i got it now..it is so simple..thanks for all your help



Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 March 2002 :  22:35:32  Show Profile
no problem!

Nikkol
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07