how to overcome this oledb error

Last post 07-01-2008 5:02 AM by Mikesdotnetting. 4 replies.

Sort Posts:

  • how to overcome this oledb error

    06-30-2008, 7:30 AM
    • Loading...
    • born2win
    • Joined on 12-28-2006, 7:22 AM
    • Posts 147

    hi, i am just using access2003 with asp.net 2.0

    this is my code:

    con.Open();

    cmd =
    new OleDbCommand("select UserId,Pwd,Authorization fom LoginUser where UserId='" + txtUserName.Text.Trim() + "' and pwd ='" + txtPassword.Text.Trim() + "'", con);

    cmd.CommandType = CommandType.Text;

    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);while (dr.Read())

    {

    if (dr.HasRows)

    {

    Session["userid"] = dr["UserId"].ToString();

    Session["authorization"] = dr["Authorization"].ToString();Server.Transfer("~/ListofVideos.aspx");

    }

    }

    i am getting  oledberror  as like this

    IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

    can any one please help me to resolve this error please

    making impossible into possible is possible when we have determination,dedication,devotion.
  • Re: how to overcome this oledb error

    06-30-2008, 7:49 AM
    Answer

    Check the UserID field name, I think it is reserved keyword in MS Access, try this keyword in [ ] backets. May be this solves your issue.

    Sincerely,
    Naveed Akhtar

    Microsoft Certified Professional Developer
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    Please remember to click “Mark as Answer”, if it is solution to your Problem
  • Re: how to overcome this oledb error

    06-30-2008, 7:51 AM
    Answer

    it may happens because you  are type a reserved word in the statement.
    Try to enclose the table's and column's name with [ ] , like [advance].

    select [pwd], [userid]..........

    Thanks and Regards
    Som Nath
    Please click “Mark as Answer” on the post if it helps you,
  • Re: how to overcome this oledb error

    07-01-2008, 12:29 AM
    • Loading...
    • born2win
    • Joined on 12-28-2006, 7:22 AM
    • Posts 147

    thank u  friends

     

    making impossible into possible is possible when we have determination,dedication,devotion.
  • Re: how to overcome this oledb error

    07-01-2008, 5:02 AM
    Answer

    I don't think that the error is a result of reserved words, as you have none.  The fact that the description of the error is missing isn't helpful ,and I would like to see your connection string, and the line that causes the error.  In the meantime, here is an article on using parameters. http://www.mikesdotnetting.com/Article.aspx?ArticleID=26.  It will help you stop just anyone logging in by entering ' or ''='.

     

    Regards Mike
    [MVP - ASP/ASP.NET]
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter