I am trying to change password option with ms access database....
please help me folks....
here the code: default.aspx.cs
protected void Button1
As error message says; OleDbDataReader has no constructor.
From documentation of OleDbDataReader;
To create an
OleDbDataReader
, you must call theExecuteReader
method of theOleDbCommand
object, instead of directly using a constructor.
You can use ExecuteReader method that returns OleDbDataReader
OleDbDataReader dr = cmd.ExecuteReader();
And you need add your parameter values before you call ExecuteReader
method.
Also use using statement to dispose your OleDbConnection
, OleDbCommand
and OleDbDataReader
like;
using(OleDbConnection myCon = new OleDbConnection(conString))
using(OleDbCommand cmd = myCon.CreateCommand())
{
//Define your sql query and add your parameter values.
using(OleDbDataReader dr = cmd.ExecuteReader())
{
//
}
}
And as Steve mentioned, OleDbDataReader.Read method returns boolean
value (true
of false
) and it reads your OleDbDataReader
results row by row. You might need to consider to use the result of this method like in a while statement. For example;
while(reader.Read())
{
//Reads your results until the last row..
}
As a final words, I strongly suspect you store your passwords as plain text. Don't do that! Use SHA-512 hash.