Copyright © 2003-2009
By Suthep Sangvirotjanaphat
  Mobile: 089-967-2200, 081-915-7816
Phone: 0-2992-4877   Fax: 0-2992-4878
Fast Contact Us
^
%
.

GreatFriends.Biz Community

Custom Search
 MESSAGE #101647 (อ่าน 929 ครั้ง)

ASP : ต้องการให้แสดงดึงภาพมาแสดงในหน้า Web โดยดึงจากฐานข้อมูล Access คะ

Tags: Windows, Web, Web Services, VB, Access, Project Management, Blog, Article, News
น้องเอ มีฟิวด์ Pic โดยเก็บเป็นรูปภาพ Type  OLE Object ในฐานข้อมูล Access โดยเรียกจาก table Ref6 ต้องการให้ดึงข้อมูลมาแสดงในหน้า Web database คะ แต่ไม่รู้ต้องเขียน code ยังงัยคะ รบกวนท่านผู้รู้หน่อยนะคะ
ถ้าใส่คำสั่งนี้เข้าไป
                             "<TD>"& rsProduct("Pic") & "</TD>"&_   
มันจะ Error ว่า  
 
Microsoft VBScript runtime error '800a000d'   
Type mismatch      
/iso/Document/iso/Catalogue_l2.asp, line 194
 
ขอบคุณมากคะ
น้องเอ
 
-------------------------------------------------------------------------------------------------------------
 
<%@codepage=874%>
<!--#include file="adovbs.inc"-->
<html>
<head>
<style>
<!--
.skin0 {
position:absolute;
text-align:left;
width:200px;
border:1px solid yellow;
background-color:red;
font-family:Verdana;
font-size: 5pt;
line-height:10px;
cursor:default;
visibility:hidden;
}
.menuitems {
padding-left:5px;
padding-right:5px;
}
.style2 {
 font-size: 13px;
 font-weight: bold;
}
body,td,th {
 font-size: x-small;
 font-family: Verdana, Arial, Helvetica, sans-serif;
}
body {
 background-image: url(image/logo1.gif);
}
.style9 {font-size: xx-small; font-weight: bold; }
-->
</style>

<script language="JavaScript">

<!-- Begin
var menuskin = "skin0";
var display_url = 0;
function showmenuie5() {
var rightedge = document.body.clientWidth-event.clientX;
var bottomedge = document.body.clientHeight-event.clientY;
if (rightedge < ie5menu.offsetWidth)
ie5menu.style.left = document.body.scrollLeft + event.clientX - ie5menu.offsetWidth;
else
ie5menu.style.left = document.body.scrollLeft + event.clientX;
if (bottomedge < ie5menu.offsetHeight)
ie5menu.style.top = document.body.scrollTop + event.clientY - ie5menu.offsetHeight;
else
ie5menu.style.top = document.body.scrollTop + event.clientY;
ie5menu.style.visibility = "visible";
return false;
}
function hidemenuie5() {
ie5menu.style.visibility = "hidden";
}
function highlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "black";
event.srcElement.style.color = "yellow";
if (display_url)
window.status = event.srcElement.url;
}
}
function lowlightie5() {
if (event.srcElement.className == "menuitems") {
event.srcElement.style.backgroundColor = "black";
event.srcElement.style.color = "yellow";
window.status = "";
}
}
function jumptoie5() {
if (event.srcElement.className == "menuitems") {
if (event.srcElement.getAttribute("target") != null)
window.open(event.srcElement.url, event.srcElement.getAttribute("target"));
else
window.location = event.srcElement.url;
}
}
// End -->
</script>
<script language=JavaScript>
<!-- Begin
function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == '' && (event.button == 2 || event.button == 3)) { alert("Sorry, you don't have permission to right-click."); return false; } return true; } document.onmousedown=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right;
// End -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body  VLINK= #0000FF><table width="100%">
  <tr valign="middle"><td width="6%"><img src="image/tumlogo.jpg" align="middle"></td>
<td width="15%"><span class="style2"><Font face="MS Sans Serif"><u>รายละเอียดCatalog</u></font></span></td>
    <td width="79%" valign="middle">      <form action="Catalogue_l2.asp" method="post"> 
   <table width="771" border="1" bgcolor="#CCCCCC" >
    <tr valign="middle">
            <td width="173" height="80"><font face="MS Sans Serif"><strong><img src="../../imageiso/icon_search_in.gif" width="24" height="24">ใส่ค่าที่ต้องการสืบค้น</strong></font></td>
         <td width="404"><p><font face="MS Sans Serif"><span class="style9">Description1</span><strong>               
           <input type="text" name="ID" size="15">
                </strong><span class="style9">Description2</span><strong>               
                <input name="ID2" type="text" id="ID2" size="15">
                <br>
                </strong><span class="style9">Description3</span><strong>               
                <input name="ID3" type="text" id="ID3" size="15">
                </strong><span class="style9">Description4</span>
                <strong>
                <input name="ID4" type="text" id="ID4" size="15">
                <br>
                </strong><span class="style9">Description5</span><strong>
                <input name="ID5" type="text" id="ID5" size="15">
                </strong><span class="style9">Description6</span>
                <strong>
                <input name="ID6" type="text" id="ID6" size="15">
                <br>
                <span class="style9">Keyword&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="ID7" type="text" id="ID7" size="47">
</strong>                        </font></p>
            </td>
         <td width="172">        <p align="center">
          <font face="MS Sans Serif"><strong>          <select name="option1" size="1">
                <option value="By Field">By Field</option>
                <option value="By All">By All </option>
             </select>
          <br>
          <br>
        <Input Type=Submit Value="Search">
        <Input Type=Reset  Value="Reset">
              <br>
</strong></font></p>   
    </tr>
   </table>
    </form></td>
</tr></table>
 <div id="ie5menu" class="skin0" onMouseover="highlightie5()" onMouseout="lowlightie5()" onClick="jumptoie5();">
<div class="menuitems"><font color="#FFFF00"><center><b>!! คำเตือน !!</b></center><b>!!สำเนาฉบับควบคุมห้ามคัดลอก!!</b></font></div>
</div>
 <%
Dim conn, rsProduct, strConn, cond, cond2, cond3, cond4, cond5, cond6, cond7
DIM sql, count
strConn = "Provider=Microsoft.jet.oledb.4.0;"&_
                  "Data Source=" & Server.MapPath("doc/Catalog.mdb") &_
               ";Jet OLEDB:Database Password=master"
Set conn = Server.CreateObject ("ADODB.Connection")
Set rsProduct= Server.CreateObject ("ADODB.Recordset")
conn.Open strConn
cond = Request.form("ID")
cond2 = Request.form("ID2")
cond3 = Request.form("ID3")
cond4 = Request.form("ID4")
cond5 = Request.form("ID5")
cond6= Request.form("ID6")
cond7= Request.form("ID7")
option1 = Request.form("option1")
if  option1 = "By Field"  then
sql = "SELECT [Main].[Ref1], [Ref1].[DescT1], [Main].[Ref2], [Ref2].[DescT2], [Main].[Ref3], [Ref3].[DescT3], [Main].[Ref4],[Ref4].[DescT4], [Main].[Ref5],[Ref5].[DescT5] , [Main].[Ref6],[Ref6].[DescT6],[Ref6].[Description],[Ref6].[Location],[Ref6].[Objective],[Ref6].[Material],[Ref6].[Remark],[Ref6].[Certificate],[Ref6].[Supplier],[Ref6].[Price],[Ref6].[Unit],[Ref6].[MinLot],[Ref6].[UserRequire],[Ref6].[Picture] ,[Ref6].[Property] ,[Ref6].[Keyword],[Ref6].[Pic] FROM (((((([Main] INNER JOIN [Ref1] ON ([Main].[Ref1] = [Ref1].[Desc1])) INNER JOIN [Ref2] ON ([Main].[Ref2] = [Ref2].[Desc2])) INNER JOIN [Ref3] ON ([Main].[Ref3] = [Ref3].[Desc3])) INNER JOIN [Ref4] ON ([Main].[Ref4] = [Ref4].[Desc4])) INNER JOIN [Ref5] ON ([Main].[Ref5] = [Ref5].[Desc5])) INNER JOIN [Ref6] ON ([Main].[Ref6] = [Ref6].[Desc6]))  where (([Ref1].[DescT1]) like   '%"&cond&"%')  and (([Ref2].[DescT2]) like   '%"&cond2&"%') and (([Ref3].[DescT3]) like   '%"&cond3&"%')  and (([Ref4].[DescT4]) like   '%"&cond4&"%')  and (([Ref5].[DescT5]) like   '%"&cond5&"%') and (([Ref6].[DescT6]) like   '%"&cond6&"%')  and (([Ref6].[Keyword]) like   '%"&cond7&"%')   ORDER BY [Main].[Ref1], [Main].[Ref2]"
elseif option1 = "By All"   then
sql = "SELECT [Main].[Ref1], [Ref1].[DescT1], [Main].[Ref2], [Ref2].[DescT2], [Main].[Ref3], [Ref3].[DescT3], [Main].[Ref4],[Ref4].[DescT4], [Main].[Ref5],[Ref5].[DescT5] , [Main].[Ref6],[Ref6].[DescT6],[Ref6].[Description],[Ref6].[Location],[Ref6].[Objective],[Ref6].[Material],[Ref6].[Remark],[Ref6].[Certificate],[Ref6].[Supplier],[Ref6].[Price],[Ref6].[Unit],[Ref6].[MinLot],[Ref6].[UserRequire],[Ref6].[Picture] ,[Ref6].[Property] ,[Ref6].[Keyword],[Ref6].[Pic]  FROM (((((([Main] INNER JOIN [Ref1] ON ([Main].[Ref1] = [Ref1].[Desc1])) INNER JOIN [Ref2] ON ([Main].[Ref2] = [Ref2].[Desc2])) INNER JOIN [Ref3] ON ([Main].[Ref3] = [Ref3].[Desc3])) INNER JOIN [Ref4] ON ([Main].[Ref4] = [Ref4].[Desc4])) INNER JOIN [Ref5] ON ([Main].[Ref5] = [Ref5].[Desc5])) INNER JOIN [Ref6] ON ([Main].[Ref6] = [Ref6].[Desc6]))  where (([Ref1].[DescT1]) like   '%"&cond7&"%')  or (([Ref2].[DescT2]) like   '%"&cond7&"%') or (([Ref3].[DescT3]) like   '%"&cond7&"%')  or (([Ref4].[DescT4]) like   '%"&cond7&"%')  or (([Ref5].[DescT5]) like   '%"&cond7&"%') or (([Ref6].[DescT6]) like   '%"&cond7&"%')  or (([Ref6].[Keyword]) like   '%"&cond7&"%')   ORDER BY [Main].[Ref1], [Main].[Ref2]"
end if
rsProduct.open sql, conn, 1, 3
if Not rsProduct.EOF then
  %>
 <%
 Response.write "<TABLE BORDER=1 >"&_
                                                 "<TR ALIGN=center BGCOLOR=yellow>"&_
       "<TD>Ref1</TD>"&_
       "<TD>Description1</TD>"&_
       "<TD>Ref2</TD>"&_
       "<TD>Description2</TD>"&_
       "<TD>Ref3</TD>"&_
       "<TD>Description3</TD>"&_
       "<TD>Ref4</TD>"&_
       "<TD>Description4</TD>"&_
       "<TD>Ref5</TD>"&_
       "<TD>Description5</TD>"&_
       "<TD>Ref6</TD>"&_
       "<TD>Description6</TD>"&_
       "<TD>Description</TD>"&_
       "<TD>Location</TD>"&_
       "<TD>Objective</TD>"&_
       "<TD>Material</TD>"&_
       "<TD>Remark</TD>"&_
       "<TD>Certificate</TD>"&_
       "<TD>Supplier</TD>"&_
       "<TD>Price</TD>"&_
       "<TD>Unit</TD>"&_
       "<TD>Minimum Lot.</TD>"&_
       "<TD>UserRequire</TD>"&_
       "<TD>Keyword</TD>"&_
       "<TD>Pic</TD>"&_
       "<TD>Property</TD>"&_
       "<TD>Picture</TD></TR>"
       
Do while not rsProduct.eof
Response.Write "<TD>"& rsProduct("Ref1") & "</TD>"&_
        "<TD>"& rsProduct("DescT1") & "</TD>"&_
        "<TD>"& rsProduct("Ref2") & "</TD>"&_
        "<TD>"& rsProduct("DescT2") & "</TD>"&_
        "<TD>"& rsProduct("Ref3") & "</TD>"&_
                             "<TD>"& rsProduct("DescT3") & "</TD>"&_
                             "<TD>"& rsProduct("Ref4") & "</TD>"&_
                             "<TD>"& rsProduct("DescT4") & "</TD>"&_
                             "<TD>"& rsProduct("Ref5") & "</TD>"&_
                             "<TD>"& rsProduct("DescT5") & "</TD>"&_
                             "<TD>"& rsProduct("Ref6") & "</TD>"&_
                             "<TD>"& rsProduct("DescT6") & "</TD>"&_
                             "<TD>"& rsProduct("Description") & "</TD>"&_
                             "<TD>"& rsProduct("Location") & "</TD>"&_
                             "<TD>"& rsProduct("Objective") & "</TD>"&_
                             "<TD>"& rsProduct("Material") & "</TD>"&_
                             "<TD>"& rsProduct("Remark") & "</TD>"&_
                             "<TD>"& rsProduct("Certificate") & "</TD>"&_
                             "<TD>"& rsProduct("Supplier") & "</TD>"&_
                             "<TD>"& rsProduct("Price") & "</TD>"&_
                             "<TD>"& rsProduct("Unit") & "</TD>"&_
                             "<TD>"& rsProduct("MinLot") & "</TD>"&_
                             "<TD>"& rsProduct("UserRequire") & "</TD>"&_       
                             "<TD>"& rsProduct("Keyword") & "</TD>"&_      
                             "<TD>"& rsProduct("Pic") & "</TD>"&_       
                             "<TD><a href="& " http://172.16.7.22/iso/Document/iso/doc/picture/"& rsProduct("Property") & " target=""_blank"">" &  rsProduct("Property") &"</A></TD>"&_       
        "<TD><a href="& " http://172.16.7.22/iso/Document/iso/doc/picture/"& rsProduct("Picture") & " target=""_blank"">" &  rsProduct("Picture") &"</A></TD></TR>"             
rsProduct.Movenext
count = count + 1
loop
Response.Write"</Table>"

ELSE
Response.Write"<BR> data not found"
end if

conn.Close
Set conn = Nothing

%>
 <%
if count >= 1 then
Response.Write "เอกสารที่พบ จำนวน " & count & " รายการ"
end if

%>
<p><script language="JavaScript">
if (document.all && window.print) {
ie5menu.className = menuskin;
document.oncontextmenu = showmenuie5;
document.body.onclick = hidemenuie5;
}
</script> 
  <BR>
</p>
</BODY>
</HTML>



sriwattana วันที่ส่ง: 28 ก.พ. 52 14:37 GMT+7
วันที่ปรับล่าสุด: 28 ก.พ. 52 14:37 GMT+7
กระทู้นี้มีอายุเกิน 365 วันแล้ว ท่านจะไม่สามารถตอบกระทู้นี้ได้อีก
ถ้าต้องการสนทนาต่อ กรุณาตั้งเป็นกระทู้ใหม่ได้ในหน้าโฮม
และอาจจะอ้างถึงกระทู้นี้ โดยก๊อปปี้ข้อความในกล่องสีขาวด้านล่างไปแปะในกระทู้ใหม่

copy เพื่ออ้างอิงถึงข้อความนี้:
ASP : ต้องการให้แสดงดึงภาพมาแสดงในหน้า Web โดยดึงจากฐานข้อมูล Access คะ
http://greatfriends.biz?101647


8 ก.ย. 19:55
Online: 164