locked
error in access database executereader() RRS feed

  • Question

  • User1827421893 posted
    What I a trying to do is get username and email id in form and check in database and if one of them exists then allow user to change it. and if both are unique then I register user. If user exists then error message ( for username) and if email exists error message for email. here is my code I get error on ExecutReader(); string query = "select username, emailid from usertable where username=@name OR emailid=@email"; OleDbConnection dbconn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString); OleDbCommand cmd1 = dbconn.CreateCommand(); cmd1.CommandText = query; cmd1.Parameters.Add("@name", OleDbType.VarChar, 50).Value = TextBoxName.Text.Trim(); cmd1.Parameters.Add("@email", OleDbType.VarChar, 50).Value = TextBoxEmail.Text.Trim(); dbconn.Open(); OleDbDataReader dr = cmd1.ExecuteReader();//<<< I get error here here is error message No value given for one or more required parameters. and i used brak point for this part of code username is and email address is taken from form dr=null
    Wednesday, May 20, 2009 2:59 AM

Answers

  • User1580727775 posted

    hi,

    Nice to hear that you have been solved. If possible elaborate your sollution a littile bit and mark your answer as answered as well as mark the thread as resolved for the sake of future readers.

     

    Happy coding

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 21, 2009 1:29 AM

All replies

  • User1580727775 posted

    What does the error message say?

    Wednesday, May 20, 2009 3:55 AM
  • User1827421893 posted

    thanks friend my problem has been solved. I applied brackets and it worked like a charm..
    Wednesday, May 20, 2009 10:04 AM
  • User1580727775 posted

    hi,

    Nice to hear that you have been solved. If possible elaborate your sollution a littile bit and mark your answer as answered as well as mark the thread as resolved for the sake of future readers.

     

    Happy coding

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, May 21, 2009 1:29 AM