<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<html>
<script language="VB" runat="server">

    Sub Page_Load(Src As Object, E As EventArgs) 
    
	'创建数据连接对象
        Dim IConn As SqlConnection
	'创建命令集对象
        Dim IComm As SqlDataAdapter

        '创建数据集
        Dim DS As DataSet

        IConn = New SqlConnection("server=cm\cm;Trusted_Connection=yes;database=model")
        IComm = New SqlDataAdapter("pro_outcount", IConn)

        '创建命令集为存储过程！

        IComm.SelectCommand.CommandType = CommandType.StoredProcedure
	
	'获得并传入参数：
        IComm.SelectCommand.Parameters.Add(New SqlParameter("@count", SqlDbType.Int))
        IComm.SelectCommand.Parameters("@count").Direction = ParameterDirection.Output

	'填充数据集
        DS = new DataSet()
        IComm.Fill(DS, "count")
	
	'数据绑定
        'IDG.DataSource=DS.Tables("count").DefaultView
        'IDG.DataBind()
        
        'If Not Page.IsPostBack Then
		TotalPages.Text = System.Math.Ceiling(IComm.SelectCommand.Parameters("@count").Value)
	'End If
    End Sub

</script>

<body bgcolor="#ccccff" style="font: 10pt verdana">
  <br><br><br>
 <center>
   .NET->有输出参数的存储过程的输出结果： <br><br><br>
   
	
   文章总数：<asp:Label id="TotalPages"  runat="server" />
 </center>

</body>
</html>
