how to add images dynamically to adrotator using database in vb.net?

Diksha dudi 126 Reputation points
2022-04-22T17:34:29.14+00:00

i want to add images from table mainindex_img dynamically to adrotator.
195627-screenshot-99.png

here at the top after the header

195691-screenshot-100.png

Developer technologies | ASP.NET | Other
{count} votes

Answer accepted by question author
  1. Lan Huang-MSFT 30,206 Reputation points Microsoft External Staff
    2022-04-25T07:32:01.293+00:00

    Hi @Diksha dudi ,
    Can you describe your needs in more detail? What does each data in the database mean?
    I guess you might want to use AdRotator with a database, you can refer to the code below.

      <asp:AdRotator id="AdRotator1" runat="server"/>  
    

     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
            Using con As SqlConnection = New SqlConnection("****")     
                Using cmd As SqlCommand = New SqlCommand("SELECT * FROM mainindex_img", con)  
                    Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)  
                    Dim dt As DataTable = New DataTable()  
                    sda.Fill(dt)  
                    AdRotator1.DataSource = dt  
                    AdRotator1.DataBind()  
                End Using  
            End Using  
        End Sub  
    

    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.