protected void Page_Load(object sender, EventArgs e) { try { if (HttpContext.Current.Session["username"].ToString() != "zdhqxc" || HttpContext.Current.Session["userpwd"].ToString() == "null") { HttpContext.Current.Response.Write(" <script> alert( '您还未登陆,请先登录!!!');window.location.href= '../Default.aspx ' </script> "); } string name = HttpContext.Current.Session["name"].ToString(); Response.Write(" <script>window.onload=function(){ var name=document.getElementById('name'); name.innerHTML='欢迎你," + name + "主任'} </script> "); } catch (Exception) { HttpContext.Current.Response.Write(" <script> alert( '您还未登陆,请先登录!!!');window.location.href= '../Default.aspx ' </script> "); } sqlTable st = new sqlTable(); string tableName = "Login"; string[] list = { "username", "password", "name", "on_job" }; DataTable loginCmd = st.selectUser(tableName, list); if (loginCmd != null) { Username_Repeater.DataSource = loginCmd; Username_Repeater.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { sqlTable st = new sqlTable(); string tableName = "Login"; string[] list = { "username", "password", "name", "on_job" }; DataTable loginCmd = st.selectUser(tableName, list); if (loginCmd != null) { Username_Repeater.DataSource = loginCmd; Username_Repeater.DataBind(); } }