第25章相片管理模块使用的是小型derby数据库,这个数据库仅用了derby.jar这样一个jar包,就将数据库嵌入到项目文件中了。项目中的“db_album”即使数据库的数据文件。
第20章通讯录管理模块就是光盘中的“communication”这个项目,这个项目的确缺少数据库文件,但由于.mdf文件过大,我给你一份sql脚本,操作如下:
1.打开Microsoft SQLServer Management Studio,在左侧“数据库”一栏上鼠标右键“新建数据库”,名称输入"db_database02",其他都默认
2.刷新左识图,然后右键"db_database02"选择“新建查询”,在打开的窗口中运行一下脚本:
[font color=#FF0000]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_LinkMan]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tb_LinkMan](
[ID] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](100) NOT NULL,
[sex] [varchar](2) NULL,
[employment] [varchar](20) NULL,
[birthday] [datetime] NULL,
[principalship] [nchar](10) NULL,
[telephone] [varchar](20) NULL,
[address] [varchar](100) NULL,
[postalcode] [varchar](6) NULL,
[QQ] [varchar](11) NULL,
[email] [varchar](100) NULL,
[picture] [varchar](100) NULL,
[SortID] [int] NOT NULL,
CONSTRAINT [PK_tb_LinkMan] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tb_sort]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[tb_sort](
[SortID] [int] IDENTITY(1,1) NOT NULL,
[SortName] [varchar](50) NOT NULL,
CONSTRAINT [PK_tb_sort] PRIMARY KEY CLUSTERED
(
[SortID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
[/font]