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

Write a function which accepts a sentence as input parameter.Each word in that sentence is to be reversed. Space should be there between each words.Return the sentence with reversed words to main function and produce the required output. for eg:- i/p: jack jill jung kill o/p: kcaj llij gnuj llik

1 Answers   Mind Tree,


Hello I am hosting remoting within IIS. Everything works just fine as long as I allow anonymous access at the IIS level. When I allow only Windows Authenticated sessions, something very strange happens: If the client activates the remote object with IP address - works fine If the client activates it using a machine name - get http 401 exception is thrown. The exception is thrown when the client calls the remote method. I set the channel's useDefaultCredentials property to true. Any idea how to allow Windows Authentication? Here is the call stack: System.Net.WebException: The remote server returned an error: (401) Unauthorized .. ---> System.ComponentModel.Win32Exception: The target principal name is incorrect at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean handshakeComplete) at System.Net.NTAuthentication.GetOutgoingBlob(String incomingBlob, Boolean handshakeComplete) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.DoAuthenticate(String challenge, WebRequest webRequest, ICredentials credentials, Boolean preAuthenticate) at System.Net.NegotiateClient.Authenticate(String challenge, WebRequest webRequest, ICredentials credentials) at System.Net.AuthenticationManager.Authenticate(String challenge, WebRequest request, ICredentials credentials) at System.Net.AuthenticationState.AttemptAuthenticate (HttpWebRequest httpWebRequest, ICredentials authInfo) --- End of inner exception stack trace ---

0 Answers   Infosys,


Write a program to convert postfix expression to infix expression.

0 Answers   Mind Tree,


Event Handling in C# Triggering a Button

1 Answers  


how to get the table names via c sharp and column names also?

2 Answers   Sify,






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

1 Answers  


Write a program which has a function and that function should take 2 or 3 or any number of strings and it should return the largest common prefix of all those strings. If there is no common prefix it should return an empty string. for eg:- INPUT OUTPUT glo {glory,glorious,glod} gl {glad,glow} {calendar,phone} empty string

2 Answers   Mind Tree,


Coding for Manipulate XML File Data Using C#?

1 Answers  


program to reverse the order of digits in a given number of any length.

1 Answers   Mind Tree,


write a Program to copy the string using switch case.

0 Answers   Mind Tree, Wipro,


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

1 Answers  


How to Create Files by Using the FileInfo Class?

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)