How to make a DataListImagesShow.Items collection and get the value = sessions (VB.NET)


I have a code that put some data in a DataList, what i need now it to make a DataListImagesShow.Items collection, and there make a value = a session-parameter.
But how do i do that !? i have look at  but cant get it.

How do i make a DataListImagesShow.Items collection that can take the tabel (From the db) "DogImageDate" and make tha value = with Session("DID") and how do i call the sub, or writeout the results on my site.

My DataList code is:

    Public Sub OpenDB()
        Dim ObjConn6 As OleDbConnection
        Dim ObjCmd6 As OleDbCommand
        Dim ObjReader6 As OleDbDataReader

        Dim ConnectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        ObjConn6 = New OleDbConnection(ConnectionString)
        If Request.QueryString("imageidentity") = Nothing OrElse Request.QueryString("imageidentity") = "" Then
            ObjCmd6 = New OleDbCommand("SELECT TOP 1 * FROM EnggaardImages ORDER BY DogImageDate DESC;", ObjConn6)
        ElseIf Request.QueryString("imageidentity") <> "" Then
            ObjCmd6 = New OleDbCommand("SELECT * FROM EnggaardImages WHERE DogImageDate =" & Request.QueryString("imageidentity") & "", ObjConn6)
        End If
            ObjReader6 = ObjCmd6.ExecuteReader(CommandBehavior.CloseConnection)
            If ObjReader6.HasRows() Then
                DataListImagesShow.DataSource = ObjReader6
                Response.Write("ingen data")
            End If
        Catch ex As Exception
            If Not ObjReader6 Is Nothing Then
            End If
            If Not ObjConn6 Is Nothing Then
            End If

        End Try
    End Sub


4/10/2007 9:09:05 PM 72751 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 4


Do you receive error message?

Please make dynamic SQL statement is correctly created.

And also ObjReader6 retrieves the correct images from DataBase.

If your images are stored in Sql Server please refer to below link on how to display binary data in the Data Web Controls:

NOTE:If you find my response contains a reference to a third party World Wide Web site, I am providing this information as a convenience to you.Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,Microsoft cannot make any representations regarding the quality,safety, or suitability of any software or information found there.

Young Fang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
4/18/2007 8:12:51 AM

Web resources about - How to make a DataListImagesShow.Items collection and get the value = sessions (VB.NET) -

Resources last updated: 11/22/2015 8:31:46 PM