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                      
Google
   
 
Categories >> Code Snippets >> Programming Code >> Dot Net Code >> C Sharp Code
 
 


 

 
 ASP.NET Code interview questions  ASP.NET Code Interview Questions (46)
 VB.NET Code interview questions  VB.NET Code Interview Questions (9)
 C Sharp Code interview questions  C Sharp Code Interview Questions (50)
 ADO.NET Code interview questions  ADO.NET Code Interview Questions (8)
Question
how to change password in .net with c # with ado.net and
also SQL server 2008
change password
 Question Submitted By :: C-Sharp-Code
I also faced this Question!!     Answer Posted By  
 
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 6 No
Arun
 

 
 
 
Other C Sharp Code Interview Questions
 
  Question Asked @ Answers
 
Coding for Manipulate XML File Data Using C#?   1
how to get the table names via c sharp and column names also? Sify 2
How to pass multiple rows from one gridview to another gridview after clicking the checkbox. Satyam 1
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)   1
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-Tree 2
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $   2
Can you declare an array of mixed Types? HCL 1
program for addition of fraction(M/N + P/Q = Y/Z) Mind-Tree 1
IS Array list is generic or non generic   1
program for string reverse(eg:- i am boy -> boy am i) Mind-Tree 8
program to reverse the order of digits in a given number of any length. Mind-Tree 1
c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's. TCS 1
 
For more C Sharp Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com