Re: Error message and can not figure it out

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

  • Next message: name: "Re: Changes are not visible with ADO and MS Access."
    Date: Sat, 19 Mar 2005 19:37:10 -0800
    
    

    okay thanks i will try that

    "Neal B. Scott" wrote:

    > See http://www.4guysfromrolla.com/webtech/092601-1.shtml
    >
    > Use question marks. Basically you want:
    > insertcmd = "INSERT INTO ESCustomermain values (?,?,?,?,?,?,?,?,?,?,?);"
    > myCommand = New SqlCommand(insertcmd)
    > mycommand.parameters.add("Boothnumber",txtBooth.Text)
    > mycommand.parameters.add("Firstname",txtFirst.Text)
    > mycommand.parameters.add("Lastname",txtLast.Text)
    > mycommand.parameters.add("Company",txtCompanyname.Text)
    > mycommand.parameters.add("Address",txtAddress.Text)
    > mycommand.parameters.add("City",txtCity.Text)
    > mycommand.parameters.add("State", txtState.Text)
    > mycommand.parameters.add("zip",txtZip.Text)
    > mycommand.parameters.add("Phone",txtphone.Text)
    > mycommand.parameters.add("Fax",txtfax.Text)
    > mycommand.parameters.add("Email",txtEmail.Text)
    >
    > "Triptaz" <Triptaz@discussions.microsoft.com> wrote in message
    > news:04B91DAF-FEC9-407A-BB31-0A721EB8F292@microsoft.com...
    > > 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
    >
    >
    >


  • Next message: name: "Re: Changes are not visible with ADO and MS Access."

    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)