Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 ASP not reading filenames stored in SQL

Author  Topic 

huge
Starting Member

31 Posts

Posted - 2002-04-19 : 17:26:34
Hey I have an image upload system and I am using a COM component called Persist ASP upload. Now everything uploads fine. I upload the image to a local dir on my machine, and I store all the image info into the database, info such as (filename, size, pictureID, description, etc...)

Anyway when I go to query my table in ASP I have a very basic Query
SELECT * FROM Pictures WHERE userID = 'someid'

Now all the other data from the table loads no problem like the Description and the PictureID. Now for some reason SQL wont pass or ASP wont read the column Filename. The filname column has the filename of the image (examople Sample(1).jpg) For some reason when I print my Recordset of that column unto the screen it returns nothing. Here is some of my relevant code...:

ORs.Movefirst
WHILE NOT Ors.EOF
i = i+1
%>
<tr bgcolor="#FFCC33">
<td width="10%">
<div align="center">
<input type="checkbox" name="chk_<%=i%>" value="<%=ORs("PictureID")%>">
</div>
</td>
<td width="45%"><%="<b>" & ORs("Description") & "</b>"%></td>
<td width="20%">
<div align="center"><img src="<%=path & ORs("Filename")%>" width="75" height="75"></div>
</td>
</tr>
<%oRs.MoveNext
WEND %>

The Recordset(ORs) is linking to Filename, and thats not working, whats wrong. Also I know that Filename is an SQL property and may cause errors in SQL, but I tried changing the name and that didnt help at all! Also I querying the database the same way I do in ASP from QA and everything was returned properly, no problems. So I think its that ASP isnt reading the Query properly. Anyone know why the heck not??

Thanks
HuGE

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-04-19 : 23:00:00
Hmmmm interesting.

Try these things, they might give you some clues.

1. Run your SQL statement in Query Analyzer so you can see if the correct data is being returned from the database.

2. What datatype are the fields ? If you have any Text, they need to be Last in the select list or ADO doesn't like it. This brings me to my next point...

3. Instead of Select * from Pictures, specify the individual columns,

I.E.

Select PictureID, FileName, Description
From Pictures Where UserID = 1



Do those things and should either fix it, or give you a good clue why it isn't working. My Guess is that description is Text and isn't the last item in your select.

Try it and let me know how you go

Damian

Edited by - merkin on 04/19/2002 23:00:39
Go to Top of Page
   

- Advertisement -