how to change password in .net with c # with ado.net and
also SQL server 2008
change password



how to change password in .net with c # with ado.net and also SQL server 2008 change password..

Answer / arun

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

Post New Answer

More C Sharp Code Interview Questions

how to change password in .net with c # with ado.net and also SQL server 2008 change password

1 Answers  


I am developing a web application using google map api.I want to update the map inside the div control within update panel. I got other controls updated but map doesn't get updated.I do not not want to update map whenever unnecessary controls are fired at server side.How could it be achieved?

0 Answers  


How to Create a Treeview Menu in ASP.NET with C#?

1 Answers  


How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?

1 Answers  


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

2 Answers   Mind Tree,






how do i copy textbox contents of 1 form to another form

4 Answers   Wipro,


Code for IP Address Comparison and Conversion in C#?

0 Answers  


. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $

3 Answers  


program to reverse the order of words in a string.

2 Answers   Mind Tree,


Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#

1 Answers  


Write a function which accepts list of nouns as input parameter and return the same list in the plural form. Conditions: i) if last letter is r then append s ii) if word ends with y then replace it by ies iii) call this function in main() and produce the required output. for eg:- if chair is input it should give chairs as output.

0 Answers   Mind Tree,


Code for Reading and writing from a file in c#?

1 Answers  


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)