Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to make image slideshow in vb.net but the source of image from database..
thanks before...
Posted
Updated 27-Dec-20 17:25pm
Comments
Sandeep Mewara 9-Jun-12 13:18pm    
Did you try anything?

Hi,

Well there are 3 steps to what you're trying to do:

Write image to the database
Get the images from the database
Display the image

The following article has a VB.Net example which covers all 3.

http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/[^]
 
Share this answer
 
Comments
kartikadh 9-Jun-12 12:40pm    
i have been write image to database.. in my database i stored the path and file name of image..
i want to make slide show like javascript slide show..
Stephen Hewison 9-Jun-12 13:15pm    
Then you're not storing the image source in the database as your question suggests. The following shows how to read an image file and load it into a bitmap object. http://www.vb-helper.com/howto_net_loadpicture.html
<div class="advert" style="width: 60%; text-align: center; cursor :pointer;">
                <asp:Image ID="Image1" runat="server" Width="100%" AlternateText="" ImageUrl="~/Images/Slide/LOGIN/2009200836335615.jpg" />
                <asp:SlideShowExtender ID="SlideShowExtender" runat="server" TargetControlID="Image1"
                    SlideShowServiceMethod="GetImages" AutoPlay="true" PlayInterval="2000" Loop="true">
                </asp:SlideShowExtender>
            </div>



<WebMethod()>
    <ScriptMethod()>
    Public Shared Function GetImages() As Slide()
        Try
            Dim slides As New List(Of Slide)()
            Dim sPath As String = HttpContext.Current.Server.MapPath("~/Images/Slide/LOGIN")
            Dim DocPath As String = ""
            If sPath.EndsWith("\") Then
                sPath = sPath.Remove(sPath.Length - 1)
            End If
            Dim info As DirectoryInfo = New DirectoryInfo(sPath)
            Dim files1 As FileInfo() = info.GetFiles().OrderByDescending(Function(DateTime) DateTime.CreationTime).ToArray()
            Dim ObjDt As DataTable

            Dim ObjUser As New User
            ObjDt = ObjUser.ListLoginSlideShowImage()
            If ObjDt.Rows.Count > 0 Then
                For i As Integer = 0 To ObjDt.Rows.Count - 1
                    DocPath = Convert.ToString(ObjDt.Rows(i)("imagepath"))
                    If DocPath.Contains("~") Then
                        DocPath = Replace(DocPath, "~", "")
                    End If
                    If DocPath <> "" Then
                        slides.Add(New Slide(DocPath, CStr(i) & "Login", Convert.ToString(ObjDt.Rows(i)("imagepath"))))
                    End If
                Next
            End If

            Return slides.ToArray()
        Catch ex As Exception
            Throw ex
        End Try
    End Function
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900