All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
SQL,Server,2000安装和基本框架_mssql学习_编程技术
超级强大的表单验证代码_JavaScript技术_编程技术
Ajax 及其入门基础(2)_[AJAX教程]
查询中where和having的区别_[SQL Server教程]
网页的新颖效果 斜着滚动的marquee_[Html教程]
C#箴言:使用构造函数初始化语句_.net资料_编程技术
PHP中的sprintf()函数的学习研究笔记_php资料_编程技术
SQL循序渐进(12)HAVING子句_[SQL,Server教程]
使用ascx和Div来扩充列表框选择功能_[Asp.Net教程]
用.NET编写串口程序的一点心得_.net资料_编程技术
Reading number is top 10 pictures
A man's favorite things7
Go to the national museum1
The world's top ten most beautiful railway station2
人美胸美腿更美2
Sora aoi mirror memorial classics5
Absolutely shocked. National geographic 50 animal photographys2
这才是真正的人体艺术2
The goddess of the single reason1
Absolutely shocked. National geographic 50 animal photographys3
China's first snake village1
Download software ranking
Unix video tutorial8
传奇私服架设教程
Tram sex maniac 2 (H) rar bag3
Tram sex maniac 2 (H) rar bag5
Proficient in Eclipse
超级战舰
matrix1
WebService在.NET中的实战应用教学视频 → 第1集
虚拟机汉化软件
Tram sex maniac 2 (H) rar bag2
delv published in(发表于) 2014/1/10 6:28:07 Edit(编辑)
ASP.NET技巧:存储过程的分析_[Asp.Net教程]

ASP.NET技巧:存储过程的分析_[Asp.Net教程]

ASP.NET技巧:存储过程的分析_[Asp.Net教程]

1 // 对存储过程的分析:实例
2 // string G_name ,string G_password为传递给此存储过程的参数,string Loging表示方法名和类型
3
4 public string Login( string G_Name , string G_Passord)
5 {
6
7 SqlConnection Conn = new SqlConnection(ConfigurationSettings.AppeSettings[ " ConnectionString " ]);
8 // 此为连接语句
9 /**/ /*
10 ConfigurationSettings.AppeSettings["ConnectionString"]
11 表示从Configurantion加载了一条连接语句
12 Config里的语句为
13
14
15

16
17 注意此标是放在的上面
18 */
19 SqlCommand Comm = new SqlCommand( " Login " ,Conn);
20 // 新建一个SqlCommand的实例Comm并把它标记为储蓄过程名为Login。
21
22 Comm.CommandType = CommandType.StoredProcedure;
23 // 将Comm标记为储蓄过程
24
25
26
27 // 下面为存储过程添加参数
28 SqlParameter parameterG_name = new SqlParameter( " @G_name " ,SqlDbType.NVarChar, 20 );
29 // 新建了一个SqlParameter的储蓄过程参数实例:实例名为pranmeterG_name
30 // 并定义了一个名为"@G_name"的参数名,定义类型SqlDbType为NvarChar 字节数为20;
31
32 parameterG_name.Value = G_Name;
33 // 为参数实例parameterG_name赋值 为这个值是从方法Login中传递进来的值
34 // 注意parameterG_name.Value=G_name 中的G_name和语句new SqlParameter("@G_name",SqlDbType.NVarChar,20);
35 // 中的@G_name是不同,@G_name是为一个SqlParameter的储蓄过程定义的一个参数名
36
37 Comm.Parameters.Add(prarameterG_name);
38 // 为Comm为添加参数paratemterG_name
39
40
41
42
43 SqlParameter parameterG_password = new SqlParameter( " @G_password " ,SqlDbType.NVarChar, 20 );
44 parameterG_password.Value = G_password;
45 Comm.Parameters.Add(parameterG_password);
46
47 SqlParameter parameterG_Id = new SqlParameter( " @G_Id " ,SqlDbType.Int, 4 );
48 parameterG_Id.Direction = ParameterDirection.Output;
49 // parameterG_Id.dDirection 获取或者设置一个值,该值指示指示参数是只可
50   // 只可以输入,只可以输出,双向 还是存储过程返回值参数
51 // ParameterDirection.Output;定义了此参数为输出参数
52 Comm.Parameters.Add(paramerG_Id);
53
54 // 打开连接并执行Command命令
55 Conn.Open();
56 Comm.ExecuteNonQuery();
57 Conn.Close();
58
59 // 对获得parameterG_Id.Value的值进行处理
60 int G_id = ( int )(parameterG_Id.Value);
61
62 if (G_id == 0 )
63 {
64 return null ;
65 // 返回空
66 }
67 else
68 {
69 G_id.ToString();
70 // 将此信息转换为等效字符串的表现形势
71 }


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.