[dbo].[Sw
ITchFocusNews]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--
=============================================
-- Author: Insus.NET
-- Create date: 2013-01-12
-- Description: 创建图片切换信息表
-- =============================================
CREATE TABLE [dbo].[SwitchFocusNews]
(
[N
br] TINYINT IDENTITY(1,1)
Primary KEY NOT NULL,
[ImageN
ame] NV
ArchAR(128) NOT NULL,
[Url] N
VARCHAR(200) NOT NULL,
[Title] NVARCHAR(200) NOT NULL
)
GO
[dbo].[usp_SwitchFocusNews_GetAll]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Insus.NET
-- Create date: 2013-01-12
-- Description: 获取所有记录
-- =============================================
CREATE
PROCEDURE [dbo].[usp_SwitchFocusNews_GetAll]
AS
SELECT [Nbr],[ImageName],[Url],[Title]
From [dbo].[SwitchFocusNews]
GO
SwitchFocusNews
Imports
System.Data
Imports Microsoft.
VisualBasic
namespace Insus.NET
P
ublic Class SwitchFocusNews
Dim objBusinessBase As New BusinessBase()
Public Function GetAll() As DataTable
Return objBusinessBase.GetDataToDataSet("usp_SwitchFocusNews_GetAll").Tables(0)
End Function
End Class
End Namespace
<%@ Control Language="
vb" AutoEventWireup="false" CodeFile="FlashAnimation.ascx.vb" Inherits="AscxControls_FlashAnimation" %>
<link
href='<%= ResolveUrl("~/FlashAnimation/css/lrtk.css")%>' rel="stylesheet" />
<script src='<%= ResolveUrl("~/FlashAnimation/js/pptBox.js")%>' ></script>
<div id="insus" >
<script>
<asp:Literal ID="LiteralSwitchImage" runat="server"></asp:Literal>
</script>
</div>
Imports System.Data
Imports Insus.NET
Partial Class AscxControls_FlashAnimation
Inherits System.Web.UI.UserControl
'实例化类别
Dim objSwitchFocusNews As New SwitchFocusNews()
Protected Sub Page_Load(sender As Object, e As Event
args) Handles Me.Load
Dim objDataTable As DataTable = objSwitchFocusNews.GetAll()
'看看数据库
是否有记录
If objDataTable.Rows.Count > 0 Then
Dim width As Integer = 500 '
宽度
Dim h
eight As Integer = 300 '高度
Dim auto
player As Integer = 3 '自动播放间隔时间
Dim si As New StringBuilder()
si.Ap
PEn
DFormat("var box = new PPTBox();")
si.AppendFormat("box.width = {0};", width)
si.AppendFormat("box.height = {0};", height)
si.AppendFormat("box.auto
player = {0};", autoPlayer)
'循环数据表,把每一条记录循环显示以下面语法中。 图片路径正确是后台上传或是编辑时存储的路径。当然你也可把存储于数据的图片显示出来。
For
each dr As DataRow In objDataTable.Rows
si.AppendFormat("box.add({{ ""url"": ""{0}"", ""href"": ""{1}"", ""title"": ""{2}""}});", ResolveUrl("~/FlashAnimation/images/" & dr("ImageName").ToString() & ""), dr("Url").ToString(), dr("Title").ToString())
Next
si.Append("box.show();")
Me.LiteralSwitchImage.Text = si.ToString()
End If
End Sub
End Class