1.创建数据表:
--
=============================================================================

/**/
/****** 对象:表 dbo.Provider_Type ******/

/**/
/****** 说明:供应商类型表表 ******/
--
=============================================================================
If
exists
(
select
*
from
sysobjects
where
id
=
object_id
(
'
dbo.Provider_Type
'
))
Drop
Table
dbo.Provider_Type
GO
Create
Table
dbo.Provider_Type(
TypeCode
varchar
(
4
)
Not
Null
Primary
Key
,
--
类型代码
TypeName
varchar
(
50
)
Not
Null
,
--
类型名称;
IfUsing
bit
Not
Null
Default
1
,
--
启用;默认启用
Note
varchar
(
100
)
Null
--
备注;
)
GO
--
-----------------------------------------------------------------------------
<
asp:Content
ID
="Content1"
ContentPlaceHolderID
="DataArea"
runat
="Server"
>
<
asp:GridView
ID
="gvDictionary"
runat
="server"
SkinID
="gvDefault"
OnRowCancelingEdit
="gvDictionary_RowCancelingEdit"
OnRowEditing
="gvDictionary_RowEditing"
OnRowUpdating
="gvDictionary_RowUpdating"
OnRowDeleting
="gvDictionary_RowDeleting"
onpageindexchanging
="gvDictionary_PageIndexChanging"
onrowdatabound
="gvDictionary_RowDataBound"
onsorting
="gvDictionary_Sorting"
>
<
Columns
>
<
asp:BoundField
ReadOnly
="true"
DataField
="DictCode"
SortExpression
="DictCode"
HeaderText
="字典编号"
></
asp:BoundField
>
<
asp:BoundField
DataField
="DictName"
SortExpression
="DictName"
HeaderText
="字典名称"
></
asp:BoundField
>
<
asp:CheckBoxField
DataField
="IfUsing"
SortExpression
="IfUsing"
HeaderText
="启用"
Text
="启用"
></
asp:CheckBoxField
>
<
asp:BoundField
DataField
="Note"
HeaderText
="备注"
></
asp:BoundField
>
<
asp:CommandField
CancelText
="取消"
EditText
="编辑"
ShowEditButton<

















2. 创建Visual Studio 2008 对数据库连接的关联操作。
菜单"View "-"Server Explorer"-"Add Connection"创建对当前数据的关联操作.
3.菜单“WebSite”-"Add New Item"添加新项操作,添加扩展名为“.dbml”文件.
4.将Provider_Type表从“Server Explorer”拖到该文件中,可根据需求对部分配置进行修改。
5.页面HTML代码如下:(我也想把图片粘出来,可是我弄上去,痛苦)











