asp.net注册表 [英] asp.net registration form

查看:89
本文介绍了asp.net注册表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在asp.net中创建一个注册表单.在将数据提交到数据库之前,如何检查用户名和电子邮件地址是否已经存在?

*需要在单独的标签中打印错误..

I wants to create a registration form in asp.net.How can check whether user name and email address already exists before submitting data in to database?

*Needed to print error in separate label..

推荐答案

您想让我们说什么?
我可以给你SQL:
What do you want us to say?
I can give you the SQL:
SELECT name, email FROM myTable WHERE name=''John Smith" AND email="JohnSmith@JohnSmith.com''

如果返回任何记录,则该用户存在!
但是,由于您没有告诉我们您需要知道的内容,因此我们所能做的不胜枚举!

If that returns any records, then the user exists!
But since you don''t tell us what you need to know, we can''t do much more than that!


在文本框旁边放置一个按钮,以检查用户名的可用性.
使用Ajax,它不会进行部分回发,因此在屏幕上不会闪烁.给出一个无缝的视图,即您的页面没有进行任何往返.

当然,如果不将其发送到数据库,则无法进行检查,因为您仅将用户名或电子邮件存储到数据库中.

您还可以在文本框textchange事件上实现此功能.但这会造成不必要的往返.

所以,祝你好运,希望你能明白我的意思...:)
Put a button beside the textbox to check the availability of the username.
Use Ajax, It will not make partial postback so no flicker on screen. Give a seamless view, that your page has not made any round trip.

and ofcourse it is not possible to check it without sending to database as you are storing the username or email to database only.

You can also implement this feature on textbox textchange event. But it will make unnecessary round trips.

So Best of luck and hope you will get my point.... :)


这篇关于asp.net注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆