Click here to Skip to main content
15,889,116 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Hardware configuration Pin
pasho14-May-04 16:38
pasho14-May-04 16:38 
GeneralMouse Wheel Scroll event in crystal report viewer Pin
Asif Rehman13-May-04 16:53
Asif Rehman13-May-04 16:53 
Generalstreamwriter problem Pin
Xun Ding13-May-04 9:50
Xun Ding13-May-04 9:50 
GeneralRe: streamwriter problem Pin
Daniel Turini13-May-04 10:22
Daniel Turini13-May-04 10:22 
GeneralRe: streamwriter problem Pin
Xun Ding13-May-04 10:48
Xun Ding13-May-04 10:48 
GeneralForms display Pin
Member 109674913-May-04 9:31
Member 109674913-May-04 9:31 
GeneralRe: Forms display Pin
Dave Kreskowiak13-May-04 11:50
mveDave Kreskowiak13-May-04 11:50 
QuestionImage problem??? Pin
Small Rat13-May-04 9:24
Small Rat13-May-04 9:24 
Hi, EveryBody,

I want to display pictures stored in a database. First I use the following code(VB6) to save the picture to the database:

Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim stream As New ADODB.stream
Set cnn = New Connection


cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\test.mdb;"
cnn.CursorLocation = adUseClient
cnn.Open
Set rst = New Recordset
rst.ActiveConnection = cnn
rst.Open "t1", cnn, adOpenKeyset, adLockOptimistic
rst.AddNew
rst!p_name = "dd"
stream.Type = adTypeBinary
stream.Open
stream.LoadFromFile "H:\pp.jpg"
rst!pic = stream.Read
Set stream = Nothing
rst.Update
cnn.Close
------------------------------
and then I use the following code(ASP) to display the image:

<%
Dim cnn
Dim rs
' Clear existing HTTP header info
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear

' Set the HTTP header to an image type.
Response.ContentType = "image/JPEG"

cnnPubs=getdbconn() ' the function return the db connection
set rs=server.CreateObject("adodb.recordset")
rs.Open "SELECT FROM t1where id=1",cnn

Response.BinaryWrite rst("pic")
Response.End
%>

and I use to show the image.
the first(vb) code works well.
but I alway can not display the image, I just got a image like red X.

please help me to solve the problem.

Thanks a lot!!!


Best!

Alan
GeneralKodak AxImgEditLibCtl question Pin
kowplunk13-May-04 7:57
kowplunk13-May-04 7:57 
GeneralRe: Kodak AxImgEditLibCtl question Pin
kowplunk13-May-04 8:01
kowplunk13-May-04 8:01 
GeneralMicrosoft Outlook 9.0 Object Library Pin
Brent Lamborn13-May-04 6:00
Brent Lamborn13-May-04 6:00 
GeneralRe: Microsoft Outlook 9.0 Object Library Pin
Dave Kreskowiak13-May-04 6:57
mveDave Kreskowiak13-May-04 6:57 
GeneralRe: Microsoft Outlook 9.0 Object Library Pin
xfitr214-May-04 7:42
xfitr214-May-04 7:42 
GeneralRe: Microsoft Outlook 9.0 Object Library Pin
Brent Lamborn14-May-04 15:19
Brent Lamborn14-May-04 15:19 
GeneralVB.NET Excell Cell Formatting Pin
CSHighCommand13-May-04 5:08
CSHighCommand13-May-04 5:08 
GeneralRe: VB.NET Excell Cell Formatting Pin
Dave Kreskowiak13-May-04 6:54
mveDave Kreskowiak13-May-04 6:54 
GeneralRe: VB.NET Excell Cell Formatting Pin
John Kuhn13-May-04 14:53
John Kuhn13-May-04 14:53 
GeneralRe: VB.NET Excell Cell Formatting Pin
Dave Kreskowiak14-May-04 0:03
mveDave Kreskowiak14-May-04 0:03 
GeneralRe: VB.NET Excell Cell Formatting Pin
mattfc14-May-04 9:09
mattfc14-May-04 9:09 
GeneralFind in Word Pin
RichardGrimmer13-May-04 2:54
RichardGrimmer13-May-04 2:54 
GeneralRe: Find in Word Pin
RichardGrimmer13-May-04 2:58
RichardGrimmer13-May-04 2:58 
GeneralDataCombo/List in VB6 Pin
Larry Gatlin13-May-04 2:33
professionalLarry Gatlin13-May-04 2:33 
GeneralRe: DataCombo/List in VB6 Pin
Dave Kreskowiak13-May-04 6:53
mveDave Kreskowiak13-May-04 6:53 
GeneralRe: DataCombo/List in VB6 Pin
Larry Gatlin13-May-04 13:36
professionalLarry Gatlin13-May-04 13:36 
GeneralOffice Addin IDTExtensibility2 Event Pin
shinay12-May-04 20:02
shinay12-May-04 20:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.