⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx.cs

📁 sqlserver:view store procedure trigger
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Data.SqlClient; 

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlConnection con1 = new SqlConnection("Server=(local);database=db_10;Uid=sa;Pwd=");
            con1.Open();
            SqlCommand cmd = new SqlCommand("ALTER  PROCEDURE [insert_加密学生信息表](@姓名_2 [varchar](50),@性别_3	[varchar](50),@年龄_4 [int],@籍贯_5 [varchar](50),@课程编号_6 [varchar](50)) AS INSERT INTO [db_09].[dbo].[学生信息表] ([姓名],[性别],[年龄], [籍贯],[课程编号]) VALUES (@姓名_2, @性别_3, @年龄_4, @籍贯_5, @课程编号_6)", con1);
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();
            con1.Close();

            SqlConnection con = new SqlConnection("Server=(local);database=db_10;Uid=sa;Pwd=");
            SqlDataAdapter dap = new SqlDataAdapter("exec sp_helptext insert_加密学生信息表", con);
            dap.SelectCommand.CommandType = CommandType.Text;
            DataSet ds = new DataSet();
            dap.Fill(ds, "table");
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
            SqlConnection con = new SqlConnection("Server=(local);database=db_10;Uid=sa;Pwd=");
            SqlDataAdapter dap = new SqlDataAdapter("exec sp_helptext insert_加密学生信息表", con);
            dap.SelectCommand.CommandType = CommandType.Text;
            DataSet ds = new DataSet();
            dap.Fill(ds, "table");
            GridView1.DataSource = ds;
            try
            {
                GridView1.DataBind();
            }
            catch
            {
                 GridView1.Rows[0].Cells[0].Text = "该存储过程已加密,无法查看!";
            }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("Server=(local);database=db_10;Uid=sa;Pwd=");
        con.Open();
        SqlCommand cmd = new SqlCommand("ALTER  PROCEDURE [insert_加密学生信息表](@姓名_2 [varchar](50),@性别_3	[varchar](50),@年龄_4 [int],@籍贯_5 [varchar](50),@课程编号_6 [varchar](50)) with encryption AS INSERT INTO [db_09].[dbo].[学生信息表] ([姓名],[性别],[年龄], [籍贯],[课程编号]) VALUES (@姓名_2, @性别_3, @年龄_4, @籍贯_5, @课程编号_6)", con);
        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();
        con.Close();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -