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

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,414 questions
{count} votes

Accepted answer
  1. Lan Huang-MSFT 28,841 Reputation points Microsoft Vendor
    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