首页 > 代码库 > 存储过程

存储过程

技术分享
 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 =http://www.mamicode.com/"";
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 =http://www.mamicode.com/= null))
40                     {
41                         parameter.Value =http://www.mamicode.com/ 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

存储过程