paul quinn
9/5/2009 12:02:00 PM
I trie to build a simple app with a DAL BLL a DetailsView
and a GridView
The database has pictureID,Name,Description,MIMEType,and
ImageData
I think the problem might be in the show picture page
My BLL is named DatingBLL My DAL is named NetMeOne My DB is named Pictures
Here is the code I used in the show picture code-behind
Imports NetMeOneTableAdapters
Partial Class ShowPicture
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.
EventArgs) Handles Me.Load
Dim PictureID As Integer = Convert.ToInt32(Request.
QueryString("PictureID"))
'Connect to the database and bring back the image contents & MIME
type for the specified picture
Using myConnection As New Data.SqlClient.
SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").
ConnectionString)
Const SQL As String = "SELECT [MIMEType], [ImageData] FROM
[Pictures] WHERE [PictureID] = @PictureID"
Dim myCommand As New Data.SqlClient.SqlCommand(SQL, myConnection)
myCommand.Parameters.AddWithValue("@PictureID", PictureID)
myConnection.Open()
Dim myReader As Data.SqlClient.SqlDataReader = myCommand.
ExecuteReader
If myReader.Read Then
Response.ContentType = myReader("MIMEType").ToString()
Response.BinaryWrite(myReader("ImageData"))
End If
myReader.Close()
myConnection.Close()
End Using
End Sub
End Class
Can someone (preferably Professor Mitchell) please Help Me
:-)