trouble showing image from database
Posted: Thu Oct 08, 2009 7:11 am
I am new to this language, decided to build a database app as my first foray into the language. I created an Access database on retriving the data everything but the image (.bmp)file associated with the records show. what am I doing wrong... here is the code for the connect and get button.
put revdb_connect("odbc","db1",,,) into tConnectionID
-- check if we could connect; if not, show an error
if tConnectionID is not a number then
answer error tConnectionID
else
-- we're connected; execute some query
put "SELECT * FROM main WHERE pID = 2 " into tQuery
put 123456789 into tID
put revdb_querylist(tab,return,tConnectionID,tQuery) into tQueryList
put revQueryDatabase(tConnectionId, tQuery, "tID") into tResultSetId
-- close the connection
#get revdb_disconnect(tConnectionID)
end if
put empty into field "FirstName"
answer tQueryList
#answer tResultSetId
#get first column from tQueryList
put revDatabaseColumnNamed(tResultSetId, "pID") into field "tID"
put revDatabaseColumnNamed(tResultSetId, "pFirstName") into field "FirstName"
put revDatabaseColumnNamed(tResultSetId, "pLastName") into field "LastName"
put revDatabaseColumnNamed(tResultSetId, "pAddress") into field "Address"
put revDatabaseColumnNamed(tResultSetId, "pCity") into field "City"
put revDatabaseColumnNamed(tResultSetId, "pState") into field "State"
put revDatabaseColumnNamed(tResultSetId, "pPhone") into field "Phone"
put revDatabaseColumnNamed(tResultSetId, "pSkills") into field "Skills"
put revDatabaseColumnNamed(tResultSetId, "pFeatures") into field "Features"
put revDatabaseColumnNamed(tResultSetId, "pAge") into field "Age"
put revDatabaseColumnNamed(tResultSetId, "pnal") into nalvar
if nalvar is "1" then
set the hilite of button "Check1" to true
end if
put revDatabaseColumnNamed(tResultSetId, "pwallow") into wallowvar
if wallowvar is "1" then
set the hilite of button "Check2" to true
end if
# the get image part of the querry
put revDatabaseColumnNamed(tResultSetId, "pPhoto") into myimage
put revDatabaseColumnNamed(tResultSetId, "pPhoto") into field "tImage"
put base64encode (url("binfile:" & myimage)) into image tImage
-- close the connection
get revdb_disconnect(tConnectionID)
end mouseUp
put revdb_connect("odbc","db1",,,) into tConnectionID
-- check if we could connect; if not, show an error
if tConnectionID is not a number then
answer error tConnectionID
else
-- we're connected; execute some query
put "SELECT * FROM main WHERE pID = 2 " into tQuery
put 123456789 into tID
put revdb_querylist(tab,return,tConnectionID,tQuery) into tQueryList
put revQueryDatabase(tConnectionId, tQuery, "tID") into tResultSetId
-- close the connection
#get revdb_disconnect(tConnectionID)
end if
put empty into field "FirstName"
answer tQueryList
#answer tResultSetId
#get first column from tQueryList
put revDatabaseColumnNamed(tResultSetId, "pID") into field "tID"
put revDatabaseColumnNamed(tResultSetId, "pFirstName") into field "FirstName"
put revDatabaseColumnNamed(tResultSetId, "pLastName") into field "LastName"
put revDatabaseColumnNamed(tResultSetId, "pAddress") into field "Address"
put revDatabaseColumnNamed(tResultSetId, "pCity") into field "City"
put revDatabaseColumnNamed(tResultSetId, "pState") into field "State"
put revDatabaseColumnNamed(tResultSetId, "pPhone") into field "Phone"
put revDatabaseColumnNamed(tResultSetId, "pSkills") into field "Skills"
put revDatabaseColumnNamed(tResultSetId, "pFeatures") into field "Features"
put revDatabaseColumnNamed(tResultSetId, "pAge") into field "Age"
put revDatabaseColumnNamed(tResultSetId, "pnal") into nalvar
if nalvar is "1" then
set the hilite of button "Check1" to true
end if
put revDatabaseColumnNamed(tResultSetId, "pwallow") into wallowvar
if wallowvar is "1" then
set the hilite of button "Check2" to true
end if
# the get image part of the querry
put revDatabaseColumnNamed(tResultSetId, "pPhoto") into myimage
put revDatabaseColumnNamed(tResultSetId, "pPhoto") into field "tImage"
put base64encode (url("binfile:" & myimage)) into image tImage
-- close the connection
get revdb_disconnect(tConnectionID)
end mouseUp