inserting data problem with something having to be declared

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


Date: Fri, 18 Mar 2005 21:45:01 -0800

i am trying to insert data from a form into a sql database. here is my code
that i have written so far:
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
        Dim MyConnection As SqlConnection

        MyConnection = New SqlConnection("server=TRIP\TRIP1;" _
            & "database=CustomerMain")

        Dim myCommand As SqlCommand
        Dim insertcmd As String
        'SQL INSERT statement string for all field values

 this line is commented out
     'insertcmd = "insert into Customer Info values ([Booth Numer],[First
name],[Last Name], Company, Address, City, Zip, Phone, Fax, Email);"
this is the line that i am trying to use
        insertcmd = "insert into Customer Info Values
(txtBooth,txtFirst,txtLast,txtCompany,txtAddress,txtCity,txtZip,txtPhone,txtFax,txtEmail);'"

        'SQL insert command for input fields
        'myCommand = New SqlCommand(insertcmd)
this is the line that is giving me problems can someone tell me what i am
doing wrong
        myCommand.Parameters("txtbooth").Value = Company.value
the COMPNAY value it tells me that it is not declared can someone tell me my
problem with this line of code

thanks would appreciate it newbie here



Relevant Pages

  • Re: Newbie with a Problem
    ... > Hope Somebody dosn`t mind Helping a Newbie? ... > Private Sub frmSystemUsers_Load(ByVal sender As System.Object, ... > First Question - Am I writing my code the correct way for a Database ...
    (microsoft.public.dotnet.framework.adonet)
  • Irgendwie hängt hier was(Grafik)
    ... ich habe ein UserControl, dass ich dreimal instanziere. ... Public Event X_Changed(ByVal sender As Object, ... Private myZ As Single ... Private Sub FRM_XYZ_MouseMove(ByVal sender As Object, ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: BindingSource.EndEdit - Not updating underlying data source
    ... Const SaveButtonText As String = "Save Zone" ... Catch ex As Exception ... Private Sub frmZones_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: What is wrong with this SQL Update Code?
    ... Is myID being set properly on the manager page? ... updating the SQL database with the edited data. ... > Private Sub btnSubmit_Click(ByVal sender As System.Object, ... > Dim myConnection As New ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: DataGridView--after sorting
    ... Dim pkValue As Object ... Private Sub DataGridView1_MouseClick(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.windowsforms)