开发者

Validate row count

I'm making an app where people need to log in, these data are on a Oracle 10g XE DB, I know how to access the data, but I don't know how to validate is the query returns something or doesn't (to validate the username and password, of course). I'm开发者_StackOverflow中文版 using an ODBC with VB.net to connect the DB. Any help? Thanks.


You can use SELECT COUNT(*) which will always return some value:

SELECT COUNT(*) AS user_ok FROM my_app_users
WHERE user_id='xxx' 
AND user_passwd=SHA256(user_salt || 'xyz')

In case user do not exists or 'xyz' is not a password you will get '0'.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜