这个没有什么好说的, GridView 最与众不同的方面。 不过, 网上大都没有实例, 分段的代码对初学者来说无疑天书!
本例是vs2008, sqlserver2005下运行无问题。
---table 也可自己建立 ,自己输入数据
Create TABLE [dbo].[test01] (
[id] [decimal](18, 0) IDENTITY (1, 1) NOT NULL ,
[name] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[card] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[xueli] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[price] [decimal](18, 0) NULL ,
[createdate] [datetime] NULL
) ON [PRIMARY]
GO
Alter TABLE [dbo].[test01] ADD
CONSTRAINT [DF_test01_createdate] DEFAULT (getdate()) FOR [createdate],
CONSTRAINT [PK_test01] PRIMARY KEY CLUSTERED
(
[id]
) ON [PRIMARY]
GO
Create TABLE [dbo].[xueli](
[id] [int] IDENTITY(1,1) NOT NULL,
[code] [int] NULL,
[description] [nvarchar](50) COLLATE Chinese_PRC_CI_AS NULL,
CONSTRAINT [PK_xueli] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
1