ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
   
 
Categories  >>  Code Snippets  >>  Programming Code  >>  Dot Net Code  >>  C Sharp Code
 
 


 

 
 ASP.NET Code interview questions  ASP.NET Code Interview Questions
 VB.NET Code interview questions  VB.NET Code Interview Questions
 C Sharp Code interview questions  C Sharp Code Interview Questions
 ADO.NET Code interview questions  ADO.NET Code Interview Questions
Question
how to change password in .net with c # with ado.net and
also SQL server 2008
change password
 Question Submitted By :: Raj12
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to change password in .net with c # with ado.net and also SQL server 2008 change password
Answer
# 1
SqlConnection objconnection = new SqlConnection();
protected void Page_Load(object sender, EventArgs e)
{
//objconnection = new OleDbConnection(ConfigurationManager.ConnectionStrings["Constr"].ConnectionString);
// objconnection.Close();
// lblInfo.Visible = false;
}
protected void Button1_Click(object sender, EventArgs e)
{
String strUsername = txtUsername.Text;
String strPassword = txtCurrentpassword.Text;
SqlConnection con = new SqlConnection("Data Source=ARUN-PC\\SQLEXPRESS;Initial Catalog=newspaper;Integrated Security=True");
con.Open();
//objectcon=new ObjectCon();


SqlCommand objcommand;
SqlDataReader objdatareader;

//OleDbCommand cmd = new OleDbCommand("Select Username,Password from Admin", objconnection);
//OleDbDataReader dr;
//jcon = new objcon();
objcommand = new SqlCommand("Select Username,Password *from Login", objconnection);
objdatareader =objcommand.ExecuteReader();
{
if (txtUsername.Text ==objdatareader.GetValue(0).ToString())

if (txtCurrentpassword.Text ==objdatareader.GetValue(1).ToString())
{
SqlCommand cmd = new SqlCommand("Update Login set Password='" + txtNewPassword.Text + "' where Username ='" + txtUsername.Text + "'", objconnection);
cmd.ExecuteNonQuery();
}
else
{

lblInfo.Visible = true;
}

else
{

lblInfo.Visible = true;
}

}
con.Close();
}
}




but my programme is not running
 
Is This Answer Correct ?    1 Yes 4 No
Arun
 

 
 
 
Other C Sharp Code Interview Questions
 
  Question Asked @ Answers
 
how to change password in .net with c # with ado.net and also SQL server 2008 change password  1
How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?  1
Write a program to count the number of characters, number of words, number of line in file. Mind-Tree2
Coding for using Nullable Types in C#?  1
How to Create Files by Using the FileInfo Class?  1
program to reverse the order of words in a string. Mind-Tree2
Write a program to input an integer and - display the reverse - display the sum of each digit - should include logic that considers the input number as any number of digits long Mind-Tree2
Can you declare an array of mixed Types? HCL1
program to reverse the order of digits in a given number of any length. Mind-Tree1
IS Array list is generic or non generic  1
Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number. Mind-Tree1
how can i split sting in textbox in windows application using c# .net  2
 
For more C Sharp Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com