Click here to Skip to main content
16,008,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi someone,

I am a beginner and i have got stuck in a small program it will be great help if somebody knows the solution about my problem.

i have to develop a code in vb.net 3.5 with ms-sqlserver2008 in which i am asking for username and password if password goes wrong then the user will hit on forgot password button there he/she will enter his/her email id, then the server will get it change and shoot a mail from there.

Thanks for your support in advance.
Posted

1 solution

Hi,

You actually didn't mention the problem but the steps to do this:
- try to logon
- catch the exception
- if the exception is login failed (18456) then redirect to another window etc and query for email adress
- if the email address is valid, change the password to something new and send the mail using System.Net.Mail

If you want the database server to handle the change then use different credentials for a new connection and for example using a stored procedure make the change to the password and use sp_send_dbmail to send the notification
 
Share this answer
 
v2
Comments
RK Anand 21-Mar-11 4:26am    
Thanks Mika for your consideration,

Can you please guide me to write code for sending an email from main server to the user when he/she click on the forgot password button.
Wendelius 21-Mar-11 4:39am    
Sending an email from the database is very simple. Just configure the database mail and have a look at the examples in http://msdn.microsoft.com/en-us/library/ms190307.aspx
RK Anand 21-Mar-11 6:31am    
Hi Mika,
I really appreciate your effort and knowledge.
But i have never used stored procedure, so please can you help me in the programing part.
Wendelius 21-Mar-11 9:08am    
Creating a procedure isn't very hard. Have a look at the examples in the documentation: http://msdn.microsoft.com/en-us/library/ms187926.aspx.

After creating the procedure, you can use ExecuteNonQuery (http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery.aspx) to call it from the client side.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900