快捷搜索:

用ASP.NET写你自己的代码生成器(c#)

<%@ Page language="c#" Codebehind="FrmMain.aspx.cs" AutoEventWireup="false" Inherits="Web_Test.FrmMain" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>FrmMain</title>
        <meta Content="Microsoft Visual Studio 7.0">
        <meta Content="C#">
        <meta content="javascript">
        <meta content="">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form method="post" runat="server">
            <asp:TextBox runat="server" Font-Size="10pt" Design_Time_Lock="True">192.168.0.220</asp:TextBox>
            <asp:Label runat="server" Font-Size="10pt" Design_Time_Lock="True">数据库列表</asp:Label>
            <asp:Label runat="server" Font-Size="10pt" Design_Time_Lock="True" Visible="False">字段名</asp:Label>
            <asp:Label runat="server" Font-Size="10pt" Design_Time_Lock="True">表名</asp:Label>
            <asp:Button runat="server" Text="GetTable" Font-Size="10pt" Design_Time_Lock="True"></asp:Button>
            <asp:Label runat="server" Font-Size="10pt" Design_Time_Lock="True">密码</asp:Label>
            <asp:Label runat="server" Font-Size="10pt" Design_Time_Lock="True">用户名</asp:Label>
            <asp:Label runat="server" Font-Size="10pt" Design_Time_Lock="True">服务器名</asp:Label>
            <asp:TextBox runat="server" Font-Size="10pt" BackColor="Transparent" ForeColor="Black" BorderColor="White" Design_Time_Lock="True"></asp:TextBox>
            <asp:TextBox runat="server" Font-Size="10pt" Design_Time_Lock="True">sa</asp:TextBox>
            <asp:DropDownList runat="server" AutoPostBack="True" Font-Size="10pt" Design_Time_Lock="True"></asp:DropDownList>
            <asp:DropDownList runat="server" Font-Size="10pt" Design_Time_Lock="True" Visible="False"></asp:DropDownList>
            <asp:Button runat="server" Text="GetDataBase" Design_Time_Lock="True"></asp:Button>
            <asp:DropDownList runat="server" Design_Time_Lock="True"></asp:DropDownList>
            <asp:Button runat="server" Text="生 成" Design_Time_Lock="True" Visible="False"></asp:Button>
            <asp:TextBox runat="server" TextMode="MultiLine" BackColor="Ivory" Design_Time_Lock="True"></asp:TextBox>
            <asp:Button runat="server" Text="实体类" Design_Time_Lock="True"></asp:Button>
            <asp:Button runat="server" Text="Test" Design_Time_Lock="True" Visible="False"></asp:Button>
            <asp:Button runat="server" Text="集合类" Design_Time_Lock="True" Visible="False"></asp:Button>
        </form>
    </body>
</HTML>
FRMMAIN.ASPX.CS

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Web_Test
{
    /// <summary>
    /// 作者:davi
    /// 日期:3003-03-18
    /// </summary>
    public class FrmMain : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.Label Label1;
        protected System.Web.UI.WebControls.Label Label2;
        protected System.Web.UI.WebControls.Label Label4;
        protected System.Web.UI.WebControls.DropDownList DropDownList1;
        protected System.Web.UI.WebControls.Label Label5;
        protected System.Web.UI.WebControls.TextBox txtServerName;
        protected System.Web.UI.WebControls.TextBox txtUserName;
        protected System.Web.UI.WebControls.TextBox txtPassword;
        protected System.Web.UI.WebControls.Button Button1;
        protected System.Web.UI.WebControls.DropDownList DropDownList2;
        protected System.Web.UI.WebControls.Label Label6;
        protected System.Web.UI.WebControls.Label Label7;
        protected System.Web.UI.WebControls.Button Button2;
        protected System.Web.UI.WebControls.DropDownList DropDownList3;
        protected System.Web.UI.WebControls.Button Button3;
        protected System.Web.UI.WebControls.TextBox txtLayOut;
        protected System.Web.UI.WebControls.Button Button4;
        protected System.Web.UI.WebControls.Button Button5;
        protected System.Web.UI.WebControls.Button Button6;
        private SqlConnection m_Scon;
        private DataSet m_DS;

您可能还会对下面的文章感兴趣: