<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
AdRotatorDataTable()
End Sub
'*** AdRotator & DataTable ***'
Function AdRotatorDataTable()
Dim provider As String = "Provider=SQLOLEDB;Data Source=(local)\SQLExpress05;Initial Catalog=tfb_data;Integrated Security=SSPI"
Dim conn As New OleDbConnection(provider)
Dim sql As String = "SELECT * FROM banner WHERE visible='Yes'"
Dim dtAdapter As OleDbDataAdapter
Dim dt As New DataTable
dtAdapter = New OleDbDataAdapter(sql, conn)
dtAdapter.Fill(dt)
dtAdapter = Nothing
conn.Close()
conn = Nothing
'*** AdRotator ***'
With Me.AdRotator2
.DataSource = dt
.ImageUrlField = "bannerurl"
.NavigateUrlField = "posterurl"
.AlternateTextField = "banner"
.DataBind()
End With
End Function
</script>
<html>
<body>
<form id="form1" runat="server">
<asp:AdRotator ID="AdRotator2" runat="server" />
</form>
</body>
</html>