Error with cmdQuestion.ExecuteReader(out dr);

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Error with cmdQuestion.ExecuteReader(out dr);

    I have a code PASTED below.Its validate(login) against a database SQL
    SERVER.
    But i have a problem with the LINE:- "cmdQuestion.ExecuteReader(out dr);"
    below

    its says ERROR :-

    "The best overloaded method match for
    'System.Data.SqlClient.SqlCommand.ExecuteReader(Sy stem.Data.CommandBehavior)
    ' has some invalid arguments"

    Can anybody help?

    -------------------------------------------------------------
    // Create a command to get the question

    SqlCommand cmdQuestion = new SqlCommand("SELECT Password FROM Users WHERE
    Email = '" + Email.Text + "'", cn);

    // Create a datareader to get the question


    //myCommand.ExecuteReader();

    cmdQuestion.ExecuteReader(out dr);



    // Get the first row

    if(dr.Read())
    if(dr["Password"].ToString() == Password.Text)
    CookieAuthentication.RedirectFromLoginPage(Email.T ext, false);
    else
    Msg.Text = "Invalid password.";
    else
    Msg.Text = "Email address not found.";
    }
    }



    Patrick.O.Ige Guest

  2. Similar Questions and Discussions

    1. Error 403 Failed to read heders Error for long-runningCFMAIL and CFINDEX command
      I have two different pages with long-running scripts on which I am recieving the following error: Error - 403 Failed to read headers to server:...
    2. System.InvalidOperationException: ExecuteReader: Connection property has not been initialized
      Hello, I dont understand whats going on with my DB2 connector. I used to have the code in a class that worked fine. But when I tried to use it in a...
    3. Error Creating Control: Parser Error DocHeader does not have a property named 'cc3:MyItems'
      I am having problems getting this webcontrol working properly. Everything else works fine except having items. So here is the low-down on the...
    4. An error occurred while try to load the string resources (GetModuleHandle failed with error -2147023888)
      Hello, on one of our customers servers we get following error on first ASPX-page: An error occurred while try to load the string resources...
    5. "Internal connection fatal error" when calling SQLCommand.ExecuteReader
      We are getting this error intermittently (about 5-10 times an hour) from one of our applications. It is not restricted to any particular page or...
  3. #2

    Default RE: Error with cmdQuestion.ExecuteReader(out dr);

    Patrick

    The ExecuteReader method only has two signatures -- one with no parameters, and one with a CommandBehavior parameter. If you are trying to compare the passwords, then you can also do something like

    SqlDataReader reader = cmdQuestion.ExecuteReader()

    while(reader.Reader()

    if(reader["Password"] == Password.Text
    // do something vali
    els
    // do something invali
    }
    David Coe, MCP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139