国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

錄播教室預約系統(三)-DepTable表[普通表]

2024-07-21 02:47:43
字體:
來源:轉載
供稿:網友
錄播教室預約系統(三)-DepTable表[普通表]

NetworkComms網絡通信框架序言

DepTable表 主要作用 存放單位名稱

如圖:

模板下載地址CodeSmith版本為v6.5

第一步:用CodeSmith模板生成DepTable表相關的存儲過程

生成的存儲過程如下:

/****** Object:  Stored PRocedure [dbo].DepTable_Delete    Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_Delete]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_Delete]GO/****** Object:  Stored Procedure [dbo].DepTable_SelectOne    Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_SelectOne]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_SelectOne]GO /****** Object:  Stored Procedure [dbo].DepTable_GetCount    Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_GetCount]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_GetCount]GO /****** Object:  Stored Procedure [dbo].DepTable_SelectAll    Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_SelectAll]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_SelectAll]GO/****** Object:  Stored Procedure [dbo].DepTable_Insert    Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_Insert]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_Insert]GO/****** Object:  Stored Procedure [dbo].DepTable_Update    Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_Update]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_Update]GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER ON GOCREATE PROCEDURE [dbo].DepTable_Delete/*Author:               msdcCreated:             2015-2-8Last Modified:         2015-2-8*/@Id intASDELETE FROM [dbo].[DepTable]WHERE    [Id] = @IdGOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER ON GOCREATE PROCEDURE [dbo].DepTable_GetCount/*Author:               msdcCreated:             2015-2-8Last Modified:         2015-2-8*/ASSELECT COUNT(*) FROM [dbo].[DepTable]GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GO SET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GOCREATE PROCEDURE [dbo].DepTable_SelectOne/*Author:               msdcCreated:             2015-2-8Last Modified:         2015-2-8*/@Id intASSELECT        [Id],        [Department]        FROM        [dbo].[DepTable]        WHERE        [Id] = @IdGOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER ON GOCREATE PROCEDURE [dbo].DepTable_SelectAll/*Author:               msdcCreated:             2015-2-8Last Modified:         2015-2-8*/ASSELECT        [Id],        [Department]        FROM        [dbo].[DepTable]GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER ON GOCREATE PROCEDURE [dbo].DepTable_Insert/*Author:               msdcCreated:             2015-2-8Last Modified:         2015-2-8*/@Department nvarchar(200)    ASINSERT INTO     [dbo].[DepTable] (                [Department]) VALUES (                @Department                )SELECT @@IDENTITY GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER ON GOCREATE PROCEDURE [dbo].DepTable_Update/*Author:               msdcCreated:             2015-2-8Last Modified:         2015-2-8*/    @Id int, @Department nvarchar(200) ASUPDATE         [dbo].[DepTable] SET            [Department] = @Department            WHERE            [Id] = @IdGOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GO/****** Object:  Stored Procedure [dbo].DepTable_SelectPage   Script Date: 2015年2月8日 ******/if exists (select * from [dbo].sysobjects where id = object_id(N'[dbo].[DepTable_SelectPage]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[DepTable_SelectPage]GOCREATE PROCEDURE [dbo].DepTable_SelectPage-- Author:               msdc-- Created:             2015-2-8-- Last Modified:         2015-2-8@PageNumber             int,@PageSize             intASDECLARE @PageLowerBound intDECLARE @PageUpperBound intSET @PageLowerBound = (@PageSize * @PageNumber) - @PageSizeSET @PageUpperBound = @PageLowerBound + @PageSize + 1/*Note: temp tables use the server default for collation not the database defaultso if adding character columns be sure and specify to use the database collation like thisto avoid collation errors:CREATE TABLE #PageIndexForUsers(IndexID int IDENTITY (1, 1) NOT NULL,UserName nvarchar(50) COLLATE DATABASE_DEFAULT,LoginName nvarchar(50) COLLATE DATABASE_DEFAULT) */CREATE TABLE #PageIndex (    IndexID int IDENTITY (1, 1) NOT NULL,Id Int)BEGININSERT INTO #PageIndex ( Id)SELECT        [Id]        FROM        [dbo].[DepTable]        -- WHERE-- ORDER BYENDSELECT        t1.*        FROM        [dbo].[DepTable] t1JOIN            #PageIndex t2ON                    t1.[Id] = t2.[Id]        WHERE        t2.IndexID > @PageLowerBound         AND t2.IndexID < @PageUpperBound        ORDER BY t2.IndexIDDROP TABLE #PageIndexGOSET ANSI_NULLS OFF GOSET QUOTED_IDENTIFIER OFF GO
模板生成的DepTable表相關的基礎存儲過程

DepTable_Insert 插入數據DepTable_Update 更新數據

DepTable_SelectPage 獲取分頁數據

DepTable_SelectAll 獲取所有數據

DepTable_SelectOne 獲取某個數據

DepTable_GetCount 獲取數量

DepTable_Delete 刪除某個數據

第二步:用codesmith模板生成數據層代碼:

// Author:                    msdc// Created:                    2015-2-8// Last Modified:            2015-2-8 using System;using System.IO;using System.Text;using System.Data;using System.Data.Common;using System.Data.SqlClient;using System.Configuration;using mojoPortal.Data;    namespace mojoPortal.Data{        public static class DBDepTable    {        /// <summary>        /// Gets the connection string for read.        /// </summary>        /// <returns></returns>        private static string GetReadConnectionString()        {            return ConfigurationManager.AppSettings["MSSQLConnectionString"];        }        /// <summary>        /// Gets the connection string for write.        /// </summary>        /// <returns></returns>        private static string GetWriteConnectionString()        {            if (ConfigurationManager.AppSettings["MSSQLWriteConnectionString"] != null)            {                return ConfigurationManager.AppSettings["MSSQLWriteConnectionString"];            }            return ConfigurationManager.AppSettings["MSSQLConnectionString"];        }        /// <summary>        /// Inserts a row in the DepTable table. Returns new integer id.        /// </summary>        /// <param name="department"> department </param>        /// <returns>int</returns>        public static int Create(            string department)         {            SqlParameterHelper sph = new SqlParameterHelper(GetWriteConnectionString(), "DepTable_Insert", 1);            sph.DefineSqlParam
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 淳化县| 泽州县| 商南县| 禄丰县| 宜良县| 苍溪县| 鲜城| 兴业县| 蒲城县| 阳曲县| 景东| 和林格尔县| 通城县| 永顺县| 前郭尔| 密山市| 荃湾区| 苗栗县| 镇坪县| 内丘县| 吉林省| 磴口县| 沙坪坝区| 南雄市| 兴海县| 花莲市| 青川县| 舟曲县| 诸城市| 英山县| 南江县| 上虞市| 灌南县| 东山县| 政和县| 吴堡县| 屏东市| 晋中市| 临猗县| 宁都县| 天长市|