Search:

Type: Posts; User: theoobe

Search: Search took 0.01 seconds.

  1. Replies
    10
    Views
    3,657

    Probably needs casting... if(dr.Read()) ...

    Probably needs casting...


    if(dr.Read())
    username = (String)dr["username"];
  2. Replies
    10
    Views
    3,657

    Use square brackets... dr["username"] ...

    Use square brackets...


    dr["username"]

    Returning to my earlier point about disposing your database objects, it is bad practice to leave database connections lingering, which is what you are...
  3. Replies
    10
    Views
    3,657

    OleDbDataReader dr = cmd.ExecuteReader(); And...

    OleDbDataReader dr = cmd.ExecuteReader();

    And


    if (dr.Read())

    The clue was in the exception.

    Also don't forget to Dispose cmd, db and dr, or better yet, use 'using' statements.
Results 1 to 3 of 3