开发者

I need to validate free flow textbox value matches value from database table

I need to validate a given Name field in t开发者_运维问答he asp.net form.

User Name: Alex Brandon

In the database, we have a users table with user_name column.

I need to validate on lost focus of User Name form field, that it exists in the users table and is valid else show an alert.

Does somebody has a ready solution to this?


Do you want to do it in javascript, or are you planning on a trip to the server? If it's a trip to the server (via asp.net ajax or a postback) you'd just have to.

select * from users where user_name=@name

and set the name parameter to your textbox value...

Note that unless you care about case, you may want to uppercase the two names for comparison.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜