解决方案 »
- vc4000采集卡,WDM方式首次显示不正常
- 大家觉得《C#与.NET3.0高级程序设计(特别版)》这本书怎么样啊?
- 我有一个Xml,如何填充到treeview!xml层次不限。
- 用WMI监测网络流量
- 100分请教高手:如何在客户端控制C#.net中的树,使点击结点的时候页面不刷新,急!
- 请给个往PostgreSQL插入/读取图片的列子
- 从sybase数据库读出来的都是类似于“閮戜繆瑜”这种的乱码!
- 串口读不到数据,子线程会自动退出吗?
- C#中结构体数组让C代码填充的问题(C#与C之间的代码交互)
- 关于字符数组与字符串类型的转换
- 求助各位大神一段C#代码,是关于C#控制打印机的一段代码,我不是太懂,求各位指导一下,谢谢
- 关于winform聊天的问题
http://www.cnblogs.com/yoyiorlee/archive/2009/09/20/1570631.html
//登陆页面设置
<asp:TextBox ID="txtUid" runat="server" Font-Size="9pt" Width="120px"
BackColor="White"></asp:TextBox>//用户登陆名
<asp:TextBox ID="txtPwd" runat="server" Font-Size="9pt" TextMode="Password"
Width="120px" style="margin-left: 0px" BackColor="White">
</asp:TextBox>//用户登陆密码
<asp:TextBox ID="txtVali" runat="server" Font-Size="9pt" Width="60px"
BackColor="White"></asp:TextBox>//登陆验证码
<img id="Img1" align="left" alt="看不清,请点击我!" onclick="this.src=this.src+'?'"
src="../youyu/CheckCode.aspx" style="width: 49px; height: 22px" />//验证码存放地址
<asp:ImageButton ID="ImageManage" runat="server" ImageUrl="~/image/b1.jpg"
OnClick="btnLoad_Click"/>//登陆按钮
//用户登陆验证
protected void btnLoad_Click(object sender, ImageClickEventArgs e)
{
HttpCookie cookie = Request.Cookies["CheckCode"];//记录验证CK
if (String.Compare(cookie.Value, txtVali.Text, true) != 0)
{ Response.Write("<script lanuage=javascript>alert('验证码错误');location='javascript:history.go(-1)'</script>");
}//CodeGo.net/ else
{
DataSet ds = DB.reDs("select * from tb_HuenLian where UserName='" + txtUid.Text.Trim() + "' and PassWord='" + txtPwd.Text.Trim() + "'");
int i = this.checkLogin(txtUid.Text, txtPwd.Text);
if (i > 0)
{
Session["id"] = ds.Tables[0].Rows[0][0].ToString();//记录索引项
Session["UserName"] = this.txtUid.Text;//记住用户名
Session["PassWord"] = this.txtPwd.Text;//记住密码
Page.Response.Redirect("Yonghu.aspx");//如果正确跳转到指定目录
}
else
{
Response.Write("<script lanuage=javascript>alert('用户名称或密码错误!');location='javascript:history.go(-1)'</script>");
}
}
}
//使用checkLogin方法验证数据库信息是否正确
public int checkLogin(string loginName, string loginPwd)
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conn"]);
SqlCommand myCommand = new SqlCommand("select count(*) from tb_HuenLian where UserName=@loginName and PassWord=@loginPwd", con);
myCommand.Parameters.Add(new SqlParameter("@loginName", SqlDbType.NVarChar, 20));
myCommand.Parameters["@loginName"].Value = loginName;
myCommand.Parameters.Add(new SqlParameter("@loginPwd", SqlDbType.NVarChar, 50));
myCommand.Parameters["@loginPwd"].Value = loginPwd;
myCommand.Connection.Open();
int i = (int)myCommand.ExecuteScalar();
myCommand.Connection.Close();
return i;
}