密码恢复控制 [英] password recovery control

查看:91
本文介绍了密码恢复控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了密码恢复控制功能
和m根据用户名从sql server 2000中检索邮件ID

这是代码

I used password recovery control
and m retrieve mail id from sql server 2000 according to username

here is the code

protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        try
        {
            string str = @"server=localhost;database=asp;uid=sa;pwd=sa";
            SqlConnection conn = new SqlConnection(str);
            conn.Open();
            String strcomand = "Select mailid from asp where name=''" + PasswordRecovery1.UserName + "''";
            SqlCommand cmd = new SqlCommand(strcomand, conn);
            SqlDataReader reade = cmd.ExecuteReader();
            while (reade.Read())
            {
                string uname = reade["mailid"].ToString();
            }
        }
        catch (Exception gh)
        {
            Console.WriteLine(gh.StackTrace);
        }
}



但是在提交"按钮上单击时,控件没有执行任何操作.



but on submit button click the control does not do any thing

推荐答案

您已经阅读了一段代码吗?您在哪里编写了可以在UI中向您显示已完成操作的内容?

以下是一些建议:
1.用户名将是唯一的,因此,如果存在,则相关的电子邮件ID将仅为1,这意味着在任何时间点您都将得到o或1个结果.您不应为此使用ExecuteReader . ExecuteScalar 对你有好处.

2.从数据库中获得一些结果后,即电子邮件ID,然后在UI中显示已获取某些结果的结果.如果您想以其他方式使用它,那就这么做.
Have you read your piece of code? Where have you written anything that can show you in the UI that something was done?

Here are few suggestions:
1. Username will be unique, thus if it exists the related email-id would be only 1, which means at any point of time you will get o or 1 result. You should not use ExecuteReader for that. ExecuteScalar is good for you.

2. Once you get some result from the database i.e. email id then display that in the UI that some result was fetched. If you want to use it in othjer way then do it.


这篇关于密码恢复控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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