If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Problem in Displaying a SQL Srever Image

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-04, 05:52
Mr_Shihab Mr_Shihab is offline
Registered User
 
Join Date: Apr 2004
Posts: 13
Unhappy Problem in Displaying a SQL Srever Image

Pleeeease help

I want to display an image in (Main.aspx) which contains the following tag:

<asp:Image id="img1" ImageUrl="DisplayImage.aspx?id=1007" Runat="server"/>

And I write the following Page_Load Sub for DisplayImage.aspx:

Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)

Dim SelectedID As String = Request.QueryString("id")

Dim ConnStr As String = "user id=sa;data source=Server\Instance1;initial catalog=MYDB"
Dim Conn As New SqlClient.SqlConnection(ConnStr)
Dim MyCommand As New SqlClient.SqlCommand("Select * from Students where id = " + SelectedID, Conn)
Dim SQLReader1 As SqlClient.SqlDataReader

Conn.Open()
SQLReader1 = MyComm.ExecuteReader(CommandBehavior.CloseConnecti on)
Response.BinaryWrite(SQLReader1.Item("Picture"))
Conn.Close()

End Sub

Where the SQLReader1.item("Picture") returns image value from SQL Server Table (Students)

The Problem is:
when I debug the execution of the page load, all statements(which follow the first access to the database) are not executed.

Here,for example, All statements after (SQLReader1 = MyComm.ExecuteReader) are not executed
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On