首先是数据访问层的代码:
1
using
System;
2
using
System.Data;
3
using
System.Data.SqlClient;
4
using
System.Configuration;
5![None.gif](/Images/OutliningIndicators/None.gif)
6
namespace
WebTest.Common
7![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
8![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
9
/// COperator 的摘要说明。
10
/// </summary>
11
public class COperator
12![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
13
public COperator()
14![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
15
//
16
// TODO: 在此处添加构造函数逻辑
17
//
18
}
19
public DataSet HaveParameter(string StrProcedure)
20![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
21
SqlConnection MyConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionSqlServer"]);
22
SqlCommand MyCommand = new SqlCommand();
23
MyCommand.Connection = MyConnection;
24
MyCommand.CommandType = CommandType.StoredProcedure;
25
MyCommand.CommandText = StrProcedure;
26![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
28
SqlDataAdapter MyAdapter = new SqlDataAdapter();
29
30
MyAdapter.SelectCommand= MyCommand;
31![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
32
DataSet Ds = new DataSet();
33![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
34
if (MyConnection.State==System.Data.ConnectionState.Closed)
35![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
36
MyConnection.Open();
37
}
38
// 启动一个事务
39
SqlTransaction MyTrans = MyConnection.BeginTransaction();
40![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
41
// initialize command object
42
MyCommand.Transaction = MyTrans;
43![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
44
try
45![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
46
// 进行数据库操作
47
MyAdapter.Fill(Ds);
48
MyTrans.Commit();
49
}
50
catch
51![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
52
MyTrans.Rollback();
53
}
54
finally
55![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
56
MyConnection.Close();
57
}
58![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
59
return Ds;
60
}
61![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
62
public void NoReturnFunction(string StrParameter, string StrField, string StrProcedure)
63![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
64
// 创建数据库连接和命令的对象
65
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionSqlServer"]);
66
67
SqlCommand myCommand = new SqlCommand(StrProcedure, myConnection);
68![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
69
// 指明Sql命令的操作类型是使用存储过程
70
myCommand.CommandType = CommandType.StoredProcedure;
71![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
72
SqlParameter parameterStr = new SqlParameter(StrField, SqlDbType.VarChar, 500);
73
parameterStr.Value = StrParameter;
74
myCommand.Parameters.Add(parameterStr);
75![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
76
// 打开数据库连接
77
if (myConnection.State==System.Data.ConnectionState.Closed)
78![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
79
myConnection.Open();
80
}
81![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
82
// 启动一个事务
83
SqlTransaction MyTrans = myConnection.BeginTransaction();
84![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
85
// initialize command object
86
myCommand.Transaction = MyTrans;
87![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
88
try
89![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
90
// 进行数据库操作
91
myCommand.ExecuteNonQuery();
92
MyTrans.Commit();
93
}
94
catch
95![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
96
MyTrans.Rollback();
97
}
98
finally
99![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
100
// 关闭数据库连接
101
myConnection.Close();
102
}
103
}
104![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
105
// 2参数
106
public void NoReturnFunction(string StrParameter1, string StrField1, string StrParameter2, string StrField2, string StrProcedure)
107![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
108
// 创建数据库连接和命令的对象
109
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionSqlServer"]);
110
111
SqlCommand myCommand = new SqlCommand(StrProcedure, myConnection);
112![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
113
// 指明Sql命令的操作类型是使用存储过程
114
myCommand.CommandType = CommandType.StoredProcedure;
115![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
116
SqlParameter parameterStr1 = new SqlParameter(StrField1, SqlDbType.NVarChar, 50);
117
parameterStr1.Value = StrParameter1;
118
myCommand.Parameters.Add(parameterStr1);
119![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
120
SqlParameter parameterStr2 = new SqlParameter(StrField2, SqlDbType.NVarChar, 50);
121
parameterStr2.Value = StrParameter2;
122
myCommand.Parameters.Add(parameterStr2);
123![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
124
// 打开数据库连接
125
if (myConnection.State==System.Data.ConnectionState.Closed)
126![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
127
myConnection.Open();
128
}
129![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
130
// 启动一个事务
131
SqlTransaction MyTrans = myConnection.BeginTransaction();
132![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
133
// initialize command object
134
myCommand.Transaction = MyTrans;
135![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
136
try
137![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
138
// 进行数据库操作
139
myCommand.ExecuteNonQuery();
140
MyTrans.Commit();
141
}
142
catch
143![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
144
MyTrans.Rollback();
145
}
146
finally
147![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
148
// 关闭数据库连接
149
myConnection.Close();
150
}
151![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
152
}
153
}
154
}
155
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
8
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
9
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
11
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
12
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
13
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
17
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
19
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
21
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
22
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
23
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
24
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
25
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
26
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
28
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
29
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
30
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
31
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
32
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
33
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
34
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
35
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
36
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
37
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
38
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
39
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
40
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
41
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
42
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
43
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
44
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
45
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
46
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
47
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
48
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
49
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
50
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
51
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
52
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
53
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
54
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
55
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
56
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
57
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
58
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
59
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
60
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
61
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
62
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
63
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
64
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
65
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
66
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
67
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
68
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
69
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
70
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
71
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
72
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
73
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
74
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
75
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
76
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
77
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
78
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
79
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
80
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
81
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
82
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
83
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
84
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
85
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
86
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
87
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
88
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
89
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
90
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
91
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
92
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
93
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
94
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
95
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
96
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
97
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
98
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
99
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
100
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
101
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
102
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
103
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
104
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
105
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
106
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
107
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
108
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
109
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
110
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
111
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
112
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
113
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
114
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
115
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
116
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
117
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
118
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
119
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
120
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
121
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
122
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
123
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
124
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
125
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
126
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
127
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
128
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
129
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
130
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
131
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
132
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
133
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
134
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
135
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
136
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
137
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
138
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
139
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
140
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
141
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
142
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
143
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
144
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
145
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
146
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
147
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
148
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
149
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
150
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
151
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
152
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
153
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
154
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
155
![None.gif](/Images/OutliningIndicators/None.gif)
Add:
1
using
System;
2
using
System.Collections;
3
using
System.ComponentModel;
4
using
System.Data;
5
using
System.Drawing;
6
using
System.Web;
7
using
System.Web.SessionState;
8
using
System.Web.UI;
9
using
System.Web.UI.WebControls;
10
using
System.Web.UI.HtmlControls;
11![None.gif](/Images/OutliningIndicators/None.gif)
12
namespace
WebTest
13![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
14![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
15
/// AddInfo 的摘要说明。
16
/// </summary>
17
public class AddInfo : System.Web.UI.Page
18![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
19
protected System.Web.UI.WebControls.Button BtOk;
20
protected System.Web.UI.WebControls.TextBox TextBox1;
21
22
private void Page_Load(object sender, System.EventArgs e)
23![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
24
// 在此处放置用户代码以初始化页面
25
}
26![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
28
override protected void OnInit(EventArgs e)
29![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
30
//
31
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
32
//
33
InitializeComponent();
34
base.OnInit(e);
35
}
36
37![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
38
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
39
/// 此方法的内容。
40
/// </summary>
41
private void InitializeComponent()
42![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
43
this.BtOk.Click += new System.EventHandler(this.BtOk_Click);
44
this.Load += new System.EventHandler(this.Page_Load);
45![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
46
}
47
#endregion
48![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
49
private void BtOk_Click(object sender, System.EventArgs e)
50![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
51
WebTest.Common.COperator AddObj = new WebTest.Common.COperator();
52
AddObj.NoReturnFunction(TextBox1.Text, "@StrTValues", "TS_AddValuesIntoTb");
53
}
54![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
55
}
56
}
57
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![None.gif](/Images/OutliningIndicators/None.gif)
12
![None.gif](/Images/OutliningIndicators/None.gif)
13
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
14
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
19
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
21
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
22
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
23
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
24
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
25
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
26
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
28
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
29
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
30
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
31
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
32
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
33
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
34
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
35
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
36
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
37
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
38
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
39
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
40
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
41
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
42
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
43
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
44
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
45
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
46
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
47
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
48
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
49
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
50
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
51
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
52
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
53
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
54
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
55
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
56
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
57
![None.gif](/Images/OutliningIndicators/None.gif)
Edit/Delete with DataGrid:
1
using
System;
2
using
System.Collections;
3
using
System.ComponentModel;
4
using
System.Data;
5
using
System.Drawing;
6
using
System.Web;
7
using
System.Web.SessionState;
8
using
System.Web.UI;
9
using
System.Web.UI.WebControls;
10
using
System.Web.UI.HtmlControls;
11![None.gif](/Images/OutliningIndicators/None.gif)
12
namespace
WebTest
13![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
14![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
15
/// _Default 的摘要说明。
16
/// </summary>
17
public class _Default : System.Web.UI.Page
18![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
19
protected System.Web.UI.WebControls.DataGrid DataGrid1;
20
21
private void Page_Load(object sender, System.EventArgs e)
22![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
23
// 在此处放置用户代码以初始化页面
24
if (!IsPostBack)
25![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
26
MyDataBind();
27
}
28
}
29![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
30![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
31
override protected void OnInit(EventArgs e)
32![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
33
//
34
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
35
//
36
InitializeComponent();
37
base.OnInit(e);
38
}
39
40![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
/**//// <summary>
41
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
42
/// 此方法的内容。
43
/// </summary>
44
private void InitializeComponent()
45![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
46
this.DataGrid1.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_CancelCommand);
47
this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand);
48
this.DataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_UpdateCommand);
49
this.Load += new System.EventHandler(this.Page_Load);
50![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
51
}
52
#endregion
53![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
54
private void MyDataBind()
55![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
56
WebTest.Common.COperator ShowObj = new WebTest.Common.COperator();
57
DataGrid1.DataSource = ShowObj.HaveParameter("SearchAllInfoFromTb");
58
DataGrid1.DataBind();
59
}
60![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
61
public void BtEdit(object sender, System.Web.UI.WebControls.CommandEventArgs e)
62![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
63
string Str = e.CommandArgument.ToString();
64
// Response.Write("<script>alert('xx')</script>");
65
Response.Write(Str);
66
}
67![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
68
public void BtDelete(object sender, System.Web.UI.WebControls.CommandEventArgs e)
69![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
70
WebTest.Common.COperator DeleteObj = new WebTest.Common.COperator();
71
DeleteObj.NoReturnFunction(e.CommandArgument.ToString(), "@StrID", "TS_DeleteInfoFromTb");
72
MyDataBind();
73
}
74![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
75
private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
76![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
77
DataGrid1.EditItemIndex = e.Item.ItemIndex;
78
MyDataBind();
79
}
80![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
81
private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
82![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
83
DataGrid1.EditItemIndex = -1;
84
MyDataBind();
85
}
86![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
87
private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
88![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
89
TextBox MyTb = (TextBox)e.Item.FindControl("TextBox1");
90
Label MyLb = (Label)e.Item.FindControl("LbID");
91
// int IntT = (int)DataGrid1.DataKeyField[e.Item.ItemIndex];
92
WebTest.Common.COperator UpdateObj = new WebTest.Common.COperator();
93
UpdateObj.NoReturnFunction(MyLb.Text, "@StrTID", MyTb.Text, "@StrTValues", "TS_UpdateTb");
94![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
95
DataGrid1.EditItemIndex = -1;
96
MyDataBind();
97
}
98![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
99
public void DataGrid1_OnPageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
100![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
101
//设置当前页的索引
102
DataGrid1.CurrentPageIndex = e.NewPageIndex;
103
//重新进行数据绑定
104
MyDataBind();
105
}
106
}
107
}
108
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![None.gif](/Images/OutliningIndicators/None.gif)
12
![None.gif](/Images/OutliningIndicators/None.gif)
13
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
14
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
19
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
21
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
22
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
23
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
24
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
25
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
26
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
28
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
29
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
30
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
31
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
32
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
33
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
34
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
35
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
36
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
37
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
38
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
39
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
40
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
41
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
42
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
43
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
44
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
45
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
46
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
47
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
48
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
49
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
50
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
51
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
52
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
53
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
54
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
55
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
56
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
57
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
58
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
59
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
60
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
61
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
62
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
63
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
64
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
65
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
66
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
67
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
68
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
69
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
70
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
71
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
72
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
73
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
74
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
75
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
76
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
77
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
78
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
79
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
80
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
81
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
82
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
83
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
84
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
85
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
86
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
87
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
88
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
89
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
90
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
91
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
92
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
93
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
94
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
95
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
96
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
97
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
98
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
99
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
100
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
101
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
102
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
103
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
104
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
105
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
106
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
107
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
108
![None.gif](/Images/OutliningIndicators/None.gif)
html:
1
<%
@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="WebTest._Default"
%>
2
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
3
<
HTML
>
4
<
HEAD
>
5
<
title
>
Default
</
title
>
6
<
meta
content
="Microsoft Visual Studio .NET 7.1"
name
="GENERATOR"
>
7
<
meta
content
="C#"
name
="CODE_LANGUAGE"
>
8
<
meta
content
="JavaScript"
name
="vs_defaultClientScript"
>
9
<
meta
content
="http://schemas.microsoft.com/intellisense/ie5"
name
="vs_targetSchema"
>
10
</
HEAD
>
11
<
body
MS_POSITIONING
="GridLayout"
>
12
<
form
id
="Form1"
method
="post"
runat
="server"
>
13
<
FONT
face
="宋体"
>
14
<
asp:datagrid
id
="DataGrid1"
style
="Z-INDEX: 101; LEFT: 256px; POSITION: absolute; TOP: 88px"
15
runat
="server"
OnPageIndexChanged
="DataGrid1_OnPageIndexChanged"
AutoGenerateColumns
="False"
16
DataKeyField
="TID"
PageSize
="5"
AllowPaging
="True"
>
17
<
Columns
>
18
<
asp:TemplateColumn
HeaderText
="ID"
>
19
<
ItemTemplate
>
20
<
asp:Label
id
=LbID
runat
="server"
text
='<%#
DataBinder.Eval(Container.DataItem, "TID") %
>
'>
21
</
asp:Label
>
22
</
ItemTemplate
>
23
</
asp:TemplateColumn
>
24
<
asp:TemplateColumn
HeaderText
="Values"
>
25
<
ItemTemplate
>
26
<
asp:Label
id
=LbValues
runat
="server"
text
='<%#
DataBinder.Eval(Container.DataItem, "TValues") %
>
'>
27
</
asp:Label
>
28
</
ItemTemplate
>
29
<
EditItemTemplate
>
30
<
asp:TextBox
id
=TextBox1
runat
="server"
Text
='<%#
DataBinder.Eval(Container.DataItem, "TValues") %
>
' Width="64px">
31
</
asp:TextBox
>
32
</
EditItemTemplate
>
33
</
asp:TemplateColumn
>
34
<
asp:EditCommandColumn
ButtonType
="PushButton"
UpdateText
="更新"
HeaderText
="编辑"
CancelText
="取消"
EditText
="编辑"
></
asp:EditCommandColumn
>
35
<
asp:TemplateColumn
HeaderText
="删除"
>
36
<
ItemTemplate
>
37
<
asp:Button
id
="BtDelete"
runat
="server"
Text
="删除"
CommandArgument
= '<%#
DataBinder.Eval(Container.DataItem, "TID") %
>
' OnCommand = "BtDelete">
38
</
asp:Button
>
39
</
ItemTemplate
>
40
</
asp:TemplateColumn
>
41
</
Columns
>
42
<
PagerStyle
HorizontalAlign
="Right"
Mode
="NumericPages"
></
PagerStyle
>
43
</
asp:datagrid
></
FONT
></
form
>
44
</
body
>
45
</
HTML
>
46
precedure:
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![None.gif](/Images/OutliningIndicators/None.gif)
12
![None.gif](/Images/OutliningIndicators/None.gif)
13
![None.gif](/Images/OutliningIndicators/None.gif)
14
![None.gif](/Images/OutliningIndicators/None.gif)
15
![None.gif](/Images/OutliningIndicators/None.gif)
16
![None.gif](/Images/OutliningIndicators/None.gif)
17
![None.gif](/Images/OutliningIndicators/None.gif)
18
![None.gif](/Images/OutliningIndicators/None.gif)
19
![None.gif](/Images/OutliningIndicators/None.gif)
20
![None.gif](/Images/OutliningIndicators/None.gif)
21
![None.gif](/Images/OutliningIndicators/None.gif)
22
![None.gif](/Images/OutliningIndicators/None.gif)
23
![None.gif](/Images/OutliningIndicators/None.gif)
24
![None.gif](/Images/OutliningIndicators/None.gif)
25
![None.gif](/Images/OutliningIndicators/None.gif)
26
![None.gif](/Images/OutliningIndicators/None.gif)
27
![None.gif](/Images/OutliningIndicators/None.gif)
28
![None.gif](/Images/OutliningIndicators/None.gif)
29
![None.gif](/Images/OutliningIndicators/None.gif)
30
![None.gif](/Images/OutliningIndicators/None.gif)
31
![None.gif](/Images/OutliningIndicators/None.gif)
32
![None.gif](/Images/OutliningIndicators/None.gif)
33
![None.gif](/Images/OutliningIndicators/None.gif)
34
![None.gif](/Images/OutliningIndicators/None.gif)
35
![None.gif](/Images/OutliningIndicators/None.gif)
36
![None.gif](/Images/OutliningIndicators/None.gif)
37
![None.gif](/Images/OutliningIndicators/None.gif)
38
![None.gif](/Images/OutliningIndicators/None.gif)
39
![None.gif](/Images/OutliningIndicators/None.gif)
40
![None.gif](/Images/OutliningIndicators/None.gif)
41
![None.gif](/Images/OutliningIndicators/None.gif)
42
![None.gif](/Images/OutliningIndicators/None.gif)
43
![None.gif](/Images/OutliningIndicators/None.gif)
44
![None.gif](/Images/OutliningIndicators/None.gif)
45
![None.gif](/Images/OutliningIndicators/None.gif)
46
![None.gif](/Images/OutliningIndicators/None.gif)
1
ALTER
PROCEDURE
SearchAllInfoFromTb
2![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
/**/
/*
3
(
4
@parameter1 datatype = default value,
5
@parameter2 datatype OUTPUT
6
)
7
*/
8
AS
9
select
*
from
Tb
![None.gif](/Images/OutliningIndicators/None.gif)
2
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
3
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
4
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
5
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
1
ALTER
PROCEDURE
TS_AddValuesIntoTb
2
(
3
@StrTValues
nvarchar
(
50
)
4
)
5
AS
6
insert
into
Tb
7
(TValues)
8
values
9
(
@StrTValues
)
10
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
1
ALTER
PROCEDURE
TS_DeleteInfoFromTb
2
(
3
@StrID
varchar
(
50
)
4
)
5
AS
6
delete
Tb
7
where
TID
=
@StrID
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
1
ALTER
PROCEDURE
TS_UpdateTb
2
(
3
@StrTID
nvarchar
(
50
),
4
@StrTValues
nvarchar
(
50
)
5
)
6
AS
7
update
Tb
8
set
TValues
=
@StrTValues
9
where
TID
=
@StrTID
10
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![None.gif](/Images/OutliningIndicators/None.gif)
6
![None.gif](/Images/OutliningIndicators/None.gif)
7
![None.gif](/Images/OutliningIndicators/None.gif)
8
![None.gif](/Images/OutliningIndicators/None.gif)
9
![None.gif](/Images/OutliningIndicators/None.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)