<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="DissData_vb" %>
<html>
<head>
	<script language="vb" runat="server">
	Dim NowDissSQL as DissSql
	sub Page_load(sender as object,e as EventArgs)
		if IsPostBack=false then
			if Session("NowDissSQLvb") is nothing then
				gData.Visible=true
				diss.Visible=false
				exit sub
			else
				gData.Visible=false
				diss.Visible=true
			end if
		end if
		if Session("Lg_ok")<>"-1" then
			gData.Visible=true
			diss.Visible=false
			Session("NowFile")=Request.RawUrl
			lg.Visible=true
			go.Visible=true
			ToNew.Visible=false
			Full.Visible=false
		else
			gData.Visible=false
			diss.Visible=true
			lg.Visible=false
			go.Visible=false
			ToNew.Visible=true
			Full.Visible=true
			dim NowDissSQL as DissSql=Ctype(Session("NowDissSQLvb"),DissSql)
			Dim cate as DataTable =NowDissSQL.GetAllCate()
			AllcateBind(Cate)
		end if
	end sub
	sub cate_Click(sender as object,e as CommandEventArgs)
		Response.Redirect("Showsbj.aspx?NowCateID=" + e.CommandArgument.ToString())
	end sub
	sub Full_Click(sender as object,e as EventArgs)
		Response.Redirect("Search.aspx")
	end sub
	sub ToNew_Click(sender as object,e as EventArgs)
		Response.Redirect("WriteNew.aspx")
	end sub
	sub OKClick(osender as object,e as EventArgs)
		if SQLSeerver.Text<>"" then
			NowDissSQL = new DissSql(SQLSeerver.Text,uid.Text,Password.Text,"EmploySQL")
			Session("NowSQLServer")=SQLSeerver.Text
			Session("Nowuid")=uid.Text
			Session("NowPassword")=Password.Text
			Session("NowDBName")="EmploySQL"
			Dim Cate as DataTable =NowDissSQL.GetAllCate()
			Session("NowDissSqlvb")=NowDissSQL
			gData.Visible=false
			diss.Visible=true
			AllcateBind(Cate)
		else
			err.Text="未输入SQL服务器名称"
		end if
	end sub
	sub AllcateBind(t as DataTable)
		AllCate.DataSource=t.DefaultView
		AllCate.DataBind()
		gData.Visible=false
		diss.Visible=true
	end sub
	</script>
</head>
<body background="/aspnetdata/images/winback.gif">
<form runat="server">
<asp:panel id="gData" runat="server" >
SQL服务器名称：<ASP:TEXTBOX Text="Localhost" runat="server" id="SQLSeerver" /><br>
登录ID：<ASP:TEXTBOX Text="sa" runat="server" id="uid" /><br>
密码：<ASP:TEXTBOX Runat="server" TextMode="Password" id="Password" /><ASP:button Text="OK" Runat="server" onclick="OKClick" /><br>
<asp:Label id="err" runat="server" />
</asp:panel>
<asp:panel id="diss" visible="false" runat="server" >
<p>
<img runat="server" id="go" src="go.gif" align="middle"><asp:hyperlink text="登录" navigateurl="Login.aspx" runat="server" id="lg" />
<p><asp:LinkButton Text="发表新意见" id="ToNew" onclick="ToNew_Click" runat="server" />　<asp:LinkButton Text="全文检索" id="Full" onclick="Full_Click" runat="server" />
<table align="center"><tr><td align="center"><ASP:DataGrid id="AllCate" runat="server"
        BorderColor="black"
        BorderWidth="1"
        GridLines="Both"
        CellPadding="3"
        CellSpacing="0"
        Font-Name="Verdana"
        Font-Size="9pt"
        HeaderStyle-BackColor="Blue"
        HeaderStyle-ForeColor="White"
AutoGenerateColumns="false"
>
      <Columns>
<asp:TemplateColumn HeaderText="类别" >
          <ItemTemplate>
<asp:LinkButton runat="server" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "id") %>' Text='<%# DataBinder.Eval(Container.DataItem, "cate") %>' onCommand="cate_Click" id="d1"/>
          </ItemTemplate>
        </asp:TemplateColumn>
        <asp:BoundColumn HeaderText="说明" DataField="Description"/>
        <asp:BoundColumn HeaderText="上次更新日期" DataField="nowtime"/>
        <asp:BoundColumn HeaderText="文章总数" DataField="total" ItemStyle-HorizontalAlign="right"/>
      </Columns>
</ASP:DataGrid>
</td></tr></table>
<p>站长声明：
改版以来，感谢众网友的问题，充实本区，虽然多数问题的回复人均是站长，被考倒也没关系，重要的是可集思广益，解决问题
若你是第一次使用本区，请在使用或发问前，查看<a href="note.htm">使用说明</a>，了解应如何发问，方最有效率，祝使用愉快
</asp:panel>
</form>
</body>