使用Sql Server建立一個資料庫hovertree
接著使用以下腳本建立表格hovertree_usermessage
USE [hovertree] GO /****** Object: Table [dbo].[hovertree_usermessage] ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[hovertree_usermessage]( [hvtId] [int] IDENTITY(1,1) NOT NULL, [hvtTitle] [nvarchar](500) NULL, [hvtContent] [nvarchar](max) NULL, [hvtUser] [nvarchar](50) NULL, [hvtTime] [datetime] NULL, [hvtReply] [nvarchar](max) NULL, [hvtIsShow] [bit] NULL, CONSTRAINT [PK_hovertree_usermessage] PRIMARY KEY CLUSTERED ( [hvtId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[hovertree_usermessage] ADD CONSTRAINT [DF_hovertree_usermessage_hvtTime] DEFAULT (getdate()) FOR [hvtTime] GO
那麼C#使用KeleyiSQLHelper類別往資料庫新增資料的程式碼為:
C#」>的TextBox控制項