码迷,mamicode.com
首页 > 其他好文 > 详细

存储过程

时间:2017-03-21 19:25:36      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:data   isp   name   cell   exe   rgs   har   c89   contract   

技术分享
 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Web;
 5 using System.Web.UI;
 6 using System.Web.UI.WebControls;
 7 using System.Data;
 8 using System.Data.SqlClient;
 9 using Aspose.Cells;
10 using System.Configuration;
11 
12 public partial class _Default : System.Web.UI.Page
13 {
14     protected void Page_Load(object sender, EventArgs e)
15     {
16         string connectionString = ConfigurationManager.AppSettings["RenWen_DBConnectionString"];
17         SqlConnection connection = new SqlConnection(connectionString);
18         SqlDataReader returnReader;
19         connection.Open();
20         #region                
21         SqlParameter[] parameters = {
22                     new SqlParameter("@IdentityCard", SqlDbType.NVarChar,18),
23                     new SqlParameter("@Name", SqlDbType.NVarChar,20),
24                     new SqlParameter("@birthday", SqlDbType.NVarChar,20)
25                                         };
26 
27             parameters[0].Value ="";
28 
29         #endregion
30         SqlCommand command =new SqlCommand();
31         command.CommandTimeout = 600;
32         command.CommandType = CommandType.StoredProcedure;
33         foreach (SqlParameter parameter in parameters)
34             {
35                 if (parameter != null)
36                 {
37                     // 检查未分配值的输出参数,将其分配以DBNull.Value.
38                     if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
39                         (parameter.Value == null))
40                     {
41                         parameter.Value = DBNull.Value;
42                     }
43                     command.Parameters.Add(parameter);
44                 }
45             }
46         returnReader = command.ExecuteReader(CommandBehavior.CloseConnection);
47         connection.Close();
48     }
49 
50
View Code

 http://www.cnblogs.com/knowledgesea/archive/2013/01/02/2841588.html

存储过程

标签:data   isp   name   cell   exe   rgs   har   c89   contract   

原文地址:http://www.cnblogs.com/wangsen123/p/6596051.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!