G
Guest
I am trying to use a datareader to retrieve data and set some properties. I
am getting a "Specified method is not supported" error on Line xxx. The data
base is Oracle 9i and the field is a number is Oracle, which will be an
integer.
Code below
The query will retrieve only one record or the datareader will be (empty?).
How do I test for an empty datareader and return a "You're not in the db"
exception?
Thanks for your replies
Mike
Code:
private void getUserRightsFromDB(string userLogin)
{
string SQL;
SQL = "Select ID, USER_ID, USER_NAME, USER_EMAIL, USER_RIGHTS From ";
SQL += "drewermr.TAB_USER_RIGHTS Where USER_LOGIN = '" + userLogin + "'";
//Set command type and string for command object
this.OraCommAssistLogin.CommandType = CommandType.Text;
this.OraCommAssistLogin.CommandText = SQL;
//open db
this.openDB();
dr = this.OraCommAssistLogin.ExecuteReader();
dr.Read();
//retrieve values from database
this.user.DBID = dr.GetInt16(0); // -- Linexxx
this.user.UserID = dr.GetInt16(1);
this.user.FullName = dr.GetString(2);
this.user.EmailAddress = dr.GetString(3);
this.user.UserRights = dr.GetString(4);
this.closeDB();
}
am getting a "Specified method is not supported" error on Line xxx. The data
base is Oracle 9i and the field is a number is Oracle, which will be an
integer.
Code below
The query will retrieve only one record or the datareader will be (empty?).
How do I test for an empty datareader and return a "You're not in the db"
exception?
Thanks for your replies
Mike
Code:
private void getUserRightsFromDB(string userLogin)
{
string SQL;
SQL = "Select ID, USER_ID, USER_NAME, USER_EMAIL, USER_RIGHTS From ";
SQL += "drewermr.TAB_USER_RIGHTS Where USER_LOGIN = '" + userLogin + "'";
//Set command type and string for command object
this.OraCommAssistLogin.CommandType = CommandType.Text;
this.OraCommAssistLogin.CommandText = SQL;
//open db
this.openDB();
dr = this.OraCommAssistLogin.ExecuteReader();
dr.Read();
//retrieve values from database
this.user.DBID = dr.GetInt16(0); // -- Linexxx
this.user.UserID = dr.GetInt16(1);
this.user.FullName = dr.GetString(2);
this.user.EmailAddress = dr.GetString(3);
this.user.UserRights = dr.GetString(4);
this.closeDB();
}