Default.aspx

View Code
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 id="Head1" runat="server">
    <title>无标题页</title>
</head>
<body style="font-size: 12px">
    <form id="form1" runat="server">
    <div>
        &nbsp;</div>
        <table style="border-right: #000099 thin groove; border-top: #000099 thin groove;
            border-left: #000099 thin groove; width: 447px; border-bottom: #000099 thin groove;
            height: 122px">
            <tr>
                <td>
                </td>
                <td style="text-align: center">
                    <strong><span style="font-size: 12pt; color: #000099; text-decoration: underline">ASP.net中应用存储过程</span></strong></td>
                <td>
                </td>
            </tr>
            <tr>
                <td colspan="3" rowspan="2">
        <asp:GridView ID="GridView1" runat="server" Height="4px" Width="464px" CellPadding="4" ForeColor="#333333" GridLines="None">
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#E3EAEB" />
            <EditRowStyle BackColor="#7C6F57" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
        </asp:GridView>
                </td>
            </tr>
            <tr>
            </tr>
        </table>
    </form>
</body>
</html>

Default.aspx.cs

View Code
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strCon"]);

        SqlDataAdapter da = new SqlDataAdapter("getAllEmployee",con);
        da.SelectCommand.CommandType = CommandType.StoredProcedure;
        DataSet ds = new DataSet();
        da.Fill(ds,"table");
        this.GridView1.DataSource = ds;
        this.GridView1.DataBind();


    }
}

 

posted on 2013-03-21 04:13  松竹梅  阅读(329)  评论(0编辑  收藏  举报