No accessible 'item' can be called with these arguments

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 2384 Views - Last Post: 17 August 2010 - 11:16 AM Rate Topic: -----

#16 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 203
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: No accessible 'item' can be called with these arguments

Posted 17 August 2010 - 10:03 AM

>>blush<< I did miss it.
I don't know what's wrong then.




Could you please post the most current error message that you're seeing?
The last error message that you posted is something that is generated on the Server...it's not a client-side related error message.

-Frinny

This post has been edited by Frinavale: 17 August 2010 - 10:04 AM

Was This Post Helpful? 0
  • +
  • -

#17 Guest_Guest*


Reputation:

Re: No accessible 'item' can be called with these arguments

Posted 17 August 2010 - 10:04 AM

You are correct, that error is gone but I believe I am still using the code improperly(maybe just in the wrong order).

Here's my error when I submit it to the DB:
System.Data.OleDb.OleDbException: No value given for one or more required parameters.

Here's my SQL statement when I just print it to the screen where I would have normally submitted to DB:
INSERT INTO admins(adminName,[password]) values(@adminName,@password);

Should that still just be @adminName and @password or should it have changed I'm guessing?

Here's my chunk of code:
Dim sql As String = "INSERT INTO admins(adminName,[password]) values(@adminName,@password);"
                
                Dim cmd As New OleDbCommand(sql)
                cmd.Parameters.AddWithValue("@adminName", adminName.Text)
                cmd.Parameters.AddWithValue("@password", password.Text)
                Dim myCommand As New OleDbCommand(sql, myConnection)
                Response.Write(sql)
                'myCommand.ExecuteNonQuery()
                myConnection.Close()

Was This Post Helpful? 0

#18 Guest_Guest*


Reputation:

Re: No accessible 'item' can be called with these arguments

Posted 17 August 2010 - 11:16 AM

I noticed I was running my query on myCommand object instead of cmd. I also had to change adminName.Text to request.form("adminName") and the same for password.text. All is good now!

Thanks again
Was This Post Helpful? 0

  • (2 Pages)
  • +
  • 1
  • 2