复制代码 代码如下:
[dbo].[SwitchFocusNews]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Insus.NET
-- Create date: 2013-01-12
-- Description: 创建图片切换信息表
-- =============================================
CREATE TABLE [dbo].[SwitchFocusNews]
(
[Nbr] TINYINT IDENTITY(1,1) PRIMARY KEY NOT NULL,
[ImageName] NVARCHAR(128) NOT NULL,
[Url] NVARCHAR(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
Public 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")%>' />
<script src='<%= ResolveUrl("~/FlashAnimation/js/pptBox.js")%>' ></script>
<div >
<script>
<asp:Literal 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 EventArgs) Handles Me.Load
Dim objDataTable As DataTable = objSwitchFocusNews.GetAll()
'看看数据库是否有记录
If objDataTable.Rows.Count > 0 Then
Dim width As Integer = 500 '宽度
Dim height As Integer = 300 '高度
Dim autoPlayer As Integer = 3 '自动播放间隔时间
Dim si As New StringBuilder()
si.AppendFormat("var box = new PPTBox();")
si.AppendFormat("box.width = {0};", width)
si.AppendFormat("box.height = {0};", height)
si.AppendFormat("box.autoplayer = {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
新闻热点
疑难解答
图片精选