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

Hi.

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 http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.repeateritem(VS.80).aspx  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
        Try
            ObjConn6.Open()
            ObjReader6 = ObjCmd6.ExecuteReader(CommandBehavior.CloseConnection)
            If ObjReader6.HasRows() Then
                DataListImagesShow.DataSource = ObjReader6
                DataListImagesShow.DataBind()
            Else
                Response.Write("ingen data")
            End If
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        Finally
            If Not ObjReader6 Is Nothing Then
                ObjReader6.Dispose()
            End If
            If Not ObjConn6 Is Nothing Then
                ObjConn6.Dispose()
            End If

        End Try
    End Sub
 

 

0
siraero
4/10/2007 9:09:05 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
876 Views

Similar Articles

[PageSpeed] 4

Hi,

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:

http://www.asp.net/learn/dataaccess/tutorial55vb.aspx?tabid=63


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.
__________________________________________________

Sincerely,
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.
0
Young
4/18/2007 8:12:51 AM
Reply:

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

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