newbie question

  • Thread starter Thread starter d_c
  • Start date Start date
D

d_c

Guest
Hi All,

This may seem a simple question to some but what is the best way to input an image into a table and the best way to pull it back out??

My table was working fine. I was pulling pices of text out of the table and displaying them on a web page using asp. However when I changed the data type for the column 'cat_name' in the table from 'text' to 'ole object' I got the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Cannot sort on Memo, OLE, or Hyperlink Object (cat_name).
/techvault/include/layer_sx.asp, line 155

any ideas??


-----------------------------------

this is the code I am using to call the datat from the table:

<tr>
<td>
<%
Set rs_cat = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT category.cat_id,cat_name,cat_parent,cat_des,COUNT(blog.blog_id) "_
& "AS cat_count FROM category LEFT JOIN (blog2cat LEFT JOIN blog ON blog.blog_id = blog2cat.blog_id) "_
& "ON category.cat_id = blog2cat.cat_id WHERE cat_parent = 0 " _
& "GROUP BY category.cat_id,cat_name,cat_parent,cat_des ORDER BY cat_name;"
rs_cat.Open strSQL, strCon, 1, 3

While Not rs_cat.Eof
%>
<table width="90%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td align="left">
<% If ci = rs_cat("cat_id") And rs_cat("cat_count") <> 0 Then %>
<font class="green"><b>
<% = ValidateHTML(rs_cat("cat_name")) %></b></font>  [ <b><% = rs_cat("cat_count") %>
</b> ]  
<% ElseIf rs_cat("cat_count") = 0 Then %>
<% = ValidateHTML(rs_cat("cat_name")) %>  [ <% = rs_cat("cat_count") %>
]  
<% Else
Response.Write "<a href=""index.asp?ci=" & rs_cat("cat_id") &"&s=category"""
Response.Write " title="""
If rs_cat("cat_des") <> "" Then
Response.Write ValidateHTML(rs_cat("cat_des"))
Else
Response.Write strLangALTCategoryListView & ValidateHTML(rs_cat("cat_name"))
End If
Response.Write """>" & ValidateHTML(rs_cat("cat_name")) & "</a>  [ <b>" & rs_cat("cat_count") & "</b> ]  "

End If
%><br><br>
</td>
</tr>
</table>
<% = rs_cat("cat_icon") %>

<%
ListCat rs_cat("cat_id"), 0, "CategoryViewList"
rs_cat.movenext
Wend

rs_cat.Close
Set rs_cat = Nothing
%>
 
your problem lies in the fact that you are trying to use "order by" to sort the query results - where this would work fine in a text field this does not work with an ole object... the problem is not your asp code - for testing try to simply run the query in access and see if the sort works...

HTH,
Kev
 
access

Thanks,

I've fixed the queries - i think! - i created a query in access - called super this had grouping/ order and then made another called sub which called the 'super' query and the image - 'cat_icon'. The webpage opens now but it still doesen't display the icon, instead it displays these characters - '?$'
any ideas where i should call the icon.

heres my updated code:


<%
Set rs_cat = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * From sub"
rs_cat.Open strSQL, strCon, 1, 3

While Not rs_cat.Eof
%>
<table width="90%" border="0" cellspacing="0" cellpadding="1" align="center">
<tr>
<td align="left">
<% If ci = rs_cat("cat_id") And rs_cat("cat_count") <> 0 Then %>
<font class="green"><b>
<% = ValidateHTML(rs_cat("cat_name")) %></b></font>  [ <b><% = rs_cat("cat_count") %>
</b> ]  
<% ElseIf rs_cat("cat_count") = 0 Then %>
<% = ValidateHTML(rs_cat("cat_name")) %>  [ <% = rs_cat("cat_count") %>
]   <% = rs_cat("cat_icon")%>
<% Else
Response.Write "<a href=""index.asp?ci=" & rs_cat("cat_id") &"&s=category"""
Response.Write " title="""
If rs_cat("cat_des") <> "" Then
Response.Write ValidateHTML(rs_cat("cat_des"))
Else
Response.Write strLangALTCategoryListView & ValidateHTML(rs_cat("cat_name"))
End If
Response.Write """>" & ValidateHTML(rs_cat("cat_name")) & "</a>  [ <b>" & rs_cat("cat_count") & "</b> ]  "

End If
%>

thanks again for the assistance.
 

Users who are viewing this thread

Back
Top Bottom