Default.aspx

View Code
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>
        <table style="border-right: #ff0099 thin groove; border-top: #ff0099 thin groove;
            border-left: #ff0099 thin groove; width: 342px; border-bottom: #ff0099 thin groove;
            height: 88px">
            <tr>
                <td colspan="3" style="text-align: center">
                    <strong><span style="font-size: 10pt; color: #000099; text-decoration: underline">获取数据库中所有用户视图</span></strong></td>
            </tr>
            <tr>
                <td colspan="3" rowspan="2" style="height: 42px">
                    <asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"
                        Height="1px" Width="336px">
                        <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>
    
    </div>
    </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;

using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["strCon"]);
        SqlDataAdapter dap = new SqlDataAdapter("select name as 视图名称,crdate as 创建日期,refDate as 最后修改时间 from sysobjects where xtype='v'", con);
        DataSet ds = new DataSet();
        dap.Fill(ds, "table");
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
}

 

posted on 2013-03-21 02:59  松竹梅  阅读(500)  评论(0编辑  收藏  举报