就去查下有没有这个用户名啊
selct cout(*) form table where name=@name
返回数据行数
为0无数据
selct cout(*) form table where name=@name
返回数据行数
为0无数据
解决方案 »
- "在asp.net自定义控件中"动态添加已存在的控件
- textbox 如何充满 td
- 在IIS上建立虚拟目录后,在WEB浏览器中浏览时说“网站拒绝显示此页”,是什么原因?急!!!
- 高分近来帮帮小弟!!!进来看看吧!!
- ASP.NET导出表与选择列问题
- asp.net2.0 TreeView节点派生类的问题?
- 用于域帐户可以直接访问网站么?(不用域身份简明验证)
- 求高手c/s winform中两个datagridviewer如何联动?
- 在ASP.net中如何用存储过程往数据库中添加数据?代码是怎么样的?
- 字符串转会为时间?怎么办?
- visual studio 2005 问题
- .net怎么连接MySql?
{
Response.Write("<script>alert('用户名重复,请更换用户名');windows.open(\"./AddFaGuan.aspx\");</script>");
}这样肯定不对,但是我这是唯一能想到的
{
CheckUserName();
} public void CheckUserName()
{
sqldatareader read = sqlhelper.executeread(connectionstring,commandtype.text,"SELECT UserName from LoginTable WHERE UserName='"+this.txtFaGuanName.Text.ToString()+"'")
while(read.read())
Response.Write("<script>alert('重复用户名,请重新输入用户名');windows.open(\"./AddFaGuan.aspx\");</script>");
return ;
}
TianJiaFaGuan TiJiao3 = new TianJiaFaGuan();
TiJiao3.UserName = this.txtFaGuanName.Text.Trim();
TiJiao3.Password = this.txtFaGuanPsw.Text.Trim();
TiJiao3.LeiBie = this.DropDownList1.SelectedValue.ToString().Trim(); if (TianJiaFaGuanDao.TianJiaFaGuanTable(TiJiao3) == true)
{
Response.Write("<script>alert('添加法官信息成功');window.open(\"./GuanLiPinTai.aspx\");</script>");
}
}
}我改了一下,这样做的,好像还有问题,哪位老师给我讲一下可以吗?
Response.Write("<script>alert('重复用户名,请重新输入用户名');windows.open(\"./AddFaGuan.aspx\");</script>");
return;
}》》》if(read.HasRows) {
Response.Write("<script>alert('重复用户名,请重新输入用户名');windows.open(\"./AddFaGuan.aspx\");</script>");
return;
}