Error message and can not figure it out

From: Triptaz (Triptaz_at_discussions.microsoft.com)
Date: 03/20/05


Date: Sat, 19 Mar 2005 17:31:03 -0800

Here is my code that i have written:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
        Dim myCommand As SqlCommand
        Dim insertcmd As String

        insertcmd = "INSERT INTO ESCustomermain
values(@Boothnumber,@Firstname,@Lastname,@Company,@Address,@City,@State,@zip,@Phone,@Fax,@Email);"
        myCommand = New SqlCommand(insertcmd)
        myCommand.Parameters("@Boothnumber").Value = txtBooth.Text
        myCommand.Parameters("@Firstname").Value = txtFirst.Text
        myCommand.Parameters("@Lastname").Value = txtLast.Text
        myCommand.Parameters("@Compnay").Value = txtCompanyname.Text
        myCommand.Parameters("@Address").Value = txtAddress.Text
        myCommand.Parameters("@City").Value = txtCity.Text
        myCommand.Parameters("@State").Value = txtState.Text
        myCommand.Parameters("@Zip").Value = txtZip.Text
        myCommand.Parameters("@Email").Value = txtEmail.Text
what i am trying to do is when i enter new information into the forms text
boxes i want to add this as a new record. i do not know if i am doing this
wrong. i have a connection to the database using a sqldataadapter and a
dataset. which shows me the data in the databse that i manually put in there
through SQL ENt Manager. so i know i have a connection to the database. but
can someone tell me where i am going wrong when i want to insert a new record
into the database. i hit the addbtn and i get the error:
Error System.IndexoutofRangeExceptionOccured in Sstem.data.dll
Additionalinformation:An SQL Parameter with parametername@Boothnumber is not
contained by the SQLParameter collection
HELP PLEASE!!!!!!!!as u can propbably tell i am a newbie at this



Relevant Pages

  • Re: Error message and can not figure it out
    ... myCommand = New SqlCommand ... > through SQL ENt Manager. ... so i know i have a connection to the database. ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... so what happens when a connection failure forces one station to revert ... to a local database? ... Further, you *will* have contention issues, Jet does not support record ... to the central server, but you are willing to live with periods where it ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... When the first test is run, the results are stored in the central database. ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Re: ADO Connection Timeout
    ... to the central server, but you are willing to live with periods where it ... i.e. a local database or even a text file. ... to function until the connection can be restored to the server. ...
    (microsoft.public.data.ado)
  • Re: Communicating over the internet
    ... > That way you provide one manner in which to open the database, ... > can keep the connection open and then when someone wants to ... > server as the database and the soap dll connecting with a TCP socket. ... The name of the running program might help. ...
    (microsoft.public.vb.general.discussion)