Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Displaying Jpeg's from Access Database

Hello all,
I've got a problem which I hope you can help me solve. I have some combo boxes that require a user to select values from. Depending on what was selected, I want a picture to be shown. First people need to select a country, then the site of the plant and then the person for which they want to see the data. It is at this point where I get into trouble. In the result asp page I have included this
image"
and this is the code for get_picture.asp :




New Page 1
<%
dim oconn, ors, strsql
ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/tel/database/tel_index.mdb")
set oconn = server.createobject("ADODB.connection")
set ors = server.createobject("ADODB.recordset")
oconn.open ConnString
dim ID
id = request.querystring("personalID")
response.contenttype="image/jpeg"
response.expires=0
Response.buffer = true
response.clear
strsql = "SELECT [picture] from picture WHERE personalID = '" & ID & "'order by personalID"
set ors = oconn.execute(strsql)
if not ors.eof then
response.binarywrite ors("picture")
end if

ors.close
set ors = nothing
oconn.close
set oconn = nothing
%>









When I run the pages from the top, all that is shown is a box with a red X. When I run the get_picture.asp page I get following error :
0X80040E07 : data type mismatch in criteria expression.
What am I doing wrong ? The db contains a table picture, where you have 2 fields : personalID and picture.

Comments

  • alexzhenalexzhen Member Posts: 13
    : Hello all,
    : I've got a problem which I hope you can help me solve. I have some combo boxes that require a user to select values from. Depending on what was selected, I want a picture to be shown. First people need to select a country, then the site of the plant and then the person for which they want to see the data. It is at this point where I get into trouble. In the result asp page I have included this
    : image"
    : and this is the code for get_picture.asp :
    :
    :
    :
    :
    : New Page 1
    : <%
    : dim oconn, ors, strsql
    : ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/tel/database/tel_index.mdb")
    : set oconn = server.createobject("ADODB.connection")
    : set ors = server.createobject("ADODB.recordset")
    : oconn.open ConnString
    : dim ID
    : id = request.querystring("personalID")
    : response.contenttype="image/jpeg"
    : response.expires=0
    : Response.buffer = true
    : response.clear
    : strsql = "SELECT [picture] from picture WHERE personalID = '" & ID & "'order by personalID"
    : set ors = oconn.execute(strsql)
    : if not ors.eof then
    : response.binarywrite ors("picture")
    : end if
    :
    : ors.close
    : set ors = nothing
    : oconn.close
    : set oconn = nothing
    : %>
    :
    :
    :
    :
    :
    :
    :
    :
    :
    : When I run the pages from the top, all that is shown is a box with a red X. When I run the get_picture.asp page I get following error :
    : 0X80040E07 : data type mismatch in criteria expression.
    : What am I doing wrong ? The db contains a table picture, where you have 2 fields : personalID and picture.
    :
    :
    hi, please tell what kind data type of personalID in the database? if the personalID is a number, remove a single quote around the ID.
  • JeankeJeanke Member Posts: 7
    : : Hello all,
    : : I've got a problem which I hope you can help me solve. I have some combo boxes that require a user to select values from. Depending on what was selected, I want a picture to be shown. First people need to select a country, then the site of the plant and then the person for which they want to see the data. It is at this point where I get into trouble. In the result asp page I have included this
    : : image"
    : : and this is the code for get_picture.asp :
    : :
    : :
    : :
    : :
    : : New Page 1
    : : <%
    : : dim oconn, ors, strsql
    : : ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/tel/database/tel_index.mdb")
    : : set oconn = server.createobject("ADODB.connection")
    : : set ors = server.createobject("ADODB.recordset")
    : : oconn.open ConnString
    : : dim ID
    : : id = request.querystring("personalID")
    : : response.contenttype="image/jpeg"
    : : response.expires=0
    : : Response.buffer = true
    : : response.clear
    : : strsql = "SELECT [picture] from picture WHERE personalID = '" & ID & "'order by personalID"
    : : set ors = oconn.execute(strsql)
    : : if not ors.eof then
    : : response.binarywrite ors("picture")
    : : end if
    : :
    : : ors.close
    : : set ors = nothing
    : : oconn.close
    : : set oconn = nothing
    : : %>
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : :
    : : When I run the pages from the top, all that is shown is a box with a red X. When I run the get_picture.asp page I get following error :
    : : 0X80040E07 : data type mismatch in criteria expression.
    : : What am I doing wrong ? The db contains a table picture, where you have 2 fields : personalID and picture.
    : :
    : :
    : hi, please tell what kind data type of personalID in the database? if the personalID is a number, remove a single quote around the ID.
    :
    Data type is number (long integer). In which line should I deleted the quote ?
  • alexzhenalexzhen Member Posts: 13
    : : : Hello all,
    : : : I've got a problem which I hope you can help me solve. I have some combo boxes that require a user to select values from. Depending on what was selected, I want a picture to be shown. First people need to select a country, then the site of the plant and then the person for which they want to see the data. It is at this point where I get into trouble. In the result asp page I have included this
    : : : image"
    : : : and this is the code for get_picture.asp :
    : : :
    : : :
    : : :
    : : :
    : : : New Page 1
    : : : <%
    : : : dim oconn, ors, strsql
    : : : ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/tel/database/tel_index.mdb")
    : : : set oconn = server.createobject("ADODB.connection")
    : : : set ors = server.createobject("ADODB.recordset")
    : : : oconn.open ConnString
    : : : dim ID
    : : : id = request.querystring("personalID")
    : : : response.contenttype="image/jpeg"
    : : : response.expires=0
    : : : Response.buffer = true
    : : : response.clear
    : : : strsql = "SELECT [picture] from picture WHERE personalID = '" & ID & "'order by personalID"
    : : : set ors = oconn.execute(strsql)
    : : : if not ors.eof then
    : : : response.binarywrite ors("picture")
    : : : end if
    : : :
    : : : ors.close
    : : : set ors = nothing
    : : : oconn.close
    : : : set oconn = nothing
    : : : %>
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : :
    : : : When I run the pages from the top, all that is shown is a box with a red X. When I run the get_picture.asp page I get following error :
    : : : 0X80040E07 : data type mismatch in criteria expression.
    : : : What am I doing wrong ? The db contains a table picture, where you have 2 fields : personalID and picture.
    : : :
    : : :
    : : hi, please tell what kind data type of personalID in the database? if the personalID is a number, remove a single quote around the ID.
    : :
    : Data type is number (long integer). In which line should I deleted the quote ?
    :

    hi, just replace with this (strsql = "SELECT [picture] from picture WHERE personalID = " & ID). i bid the personalID is unique, so you can remove this "order by personalID". However, if picture field in the database is OLE/Object data type, you won't see any picture on the browser. since the OLE/Object contain the program that associate the image. you can output the OLE/Object info by remark Response.ContentType="image/jpeg". Hardway, you might need to write function to strip some info from OLE/Object. The easy way, rename the image to personalID. i hoped this would help.
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ______ // http://forcoder.org // free ebooks and video tutorials about / Assembly Delphi C++ R Visual Basic PHP Scratch Visual Basic .NET Java Python MATLAB Swift Perl PL/SQL Ruby C Go Objective-C C# JavaScript Lua Fortran Logo Rust Scala Apex Transact-SQL D Erlang LabVIEW Scheme Awk ML Julia FoxPro Clojure Kotlin Hack Prolog Alice Dart F# Crystal Lisp SAS Bash COBOL Ada ABAP VBScript / __________

Sign In or Register to comment.