Click here to Skip to main content
15,949,686 members

Comments by Member 12317764 (Top 5 by date)

Member 12317764 10-Feb-16 4:51am View    
I found the problem, I removed the
cmd.Connection = connect;
connect.Open()

And it worked!, Thank you very much
Member 12317764 10-Feb-16 4:45am View    
if(tb_newPassword.Text == tb_Confirm.Text)
{
try
{
if (connect.State != ConnectionState.Open)
{
connect.Open();
OleDbCommand cmd = connect.CreateCommand();

cmd.CommandType = CommandType.Text;
cmd.CommandText = "UPDATE userInformation SET password= @password WHERE emailAddress= @email";
cmd.Parameters.AddWithValue("@password", tb_Confirm.Text);
cmd.Parameters.AddWithValue("@emaili", p_Email.Text);
cmd.Connection = connect;
connect.Open();
cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
connect.Close();
}
}



--------------------------------------------------------------
Before I debug it,
Did I add everything correctly?
Member 12317764 10-Feb-16 4:25am View    
The name of the password field in the table is "password"
Member 12317764 10-Feb-16 4:25am View    
I tried it and I this exception

"the connection was not closed, The connection's current state is open"

i then added "connect.Close()" after the cmd.ExecuteNonQuery() statement and I get the same exception
Member 12317764 10-Feb-16 3:18am View    
@Da-broken-Breakpoint

I tried it, it gives me an error that says error in UPDATE statement


These are the names of all my fields as well as my table in the database
table name = userInformation

table column = emailAddress
form textbox = p_Email
form textBox = tb_newPassword
form textBox = tb_Confirm

Am I perhaps missing a comma, or any quote marks?