存储过程
来源:互联网 发布:用matlab解决优化问题 编辑:程序博客网 时间:2024/06/10 00:33
1.前台
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="存储过程.WebForm2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="插入" onclick="Button1_Click" />
</div>
</form>
</body>
</html>
后台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
namespace 存储过程
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string strcon = @"Data Source=PC-20121114LMOU;Initial Catalog=News;Persist Security Info=True;User ID=sa;Password=842674";
SqlConnection conn = new SqlConnection(strcon);
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "Pro_GetMaxId";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@maxid",SqlDbType.Int);
//表明此@maxid为输出参数
cmd.Parameters["@maxid"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
Response.Write(cmd.Parameters["@maxid"].Value.ToString());
cmd.Dispose();
conn.Dispose();
}
}
}
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 存储过程
- 隐藏选项卡,代码片段
- js得到表格中莫一列的值
- Winsock API: bind
- D3D中的AGP内存、系统内存、显存的理解
- 存储过程
- 遇到的eclipse的问题
- 【框架解析】Hadoop系统分析(十)--对象序列化
- 运动是最佳健康良药
- 2013年手机浏览器如何站着把钱挣了?
- 最小矩阵差——有上下界的网络流问题
- 点击Android主菜单应用,直接进入Dialog对话框
- 获得选中的checkbox的value
- JS中void(0)的含义