Re: inserting data problem with something having to be declared

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


Date: Sat, 19 Mar 2005 09:37:08 -0800

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")

        MyConnection = New SqlConnection("ES2")

        Dim myCommand As SqlCommand
        Dim insertcmd As String
        'SQL INSERT statement string for all field values
        'insertcmd = "insert into Customer Info values ([Booth Numer],[First
name],[Last Name], Company, Address, City, Zip, Phone, Fax, Email);"
        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)
i am having troulbe getting the [Booth number] declared does anyone know
what i am doing wrong tried the correction and it did not work
        myCommand.Parameters("@txtbooth").Value = [Booth Number].value
        ' mycommand.Parameters("@

"Triptaz" wrote:

> This did not work because it was telling me the the & was not a defines part
> of a string
>
> "Gérard Leclercq" wrote:
>
> > Sorry,
> > ('" & txtBooth & "','" & txtFirst & "','" & txtLast etc...
> >
> >
> >



Relevant Pages

  • 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: DataGridView--after sorting
    ... Dim pkValue As Object ... Private Sub DataGridView1_MouseClick(ByVal sender As Object, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: DataView.Sort Dilemma - A bit long
    ... I have a form with a number of TextBoxes bound to a DataSet and an find ... I have got around this problem by binding the Textboxes to a DataView then ... Private Sub btAdd_Click(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: remoting client form, reference to object
    ... remoting is configured before anything else happens. ... > Private Sub Button1_Click(ByVal sender As System.Object, ... > private void ButtonCall_Click ...
    (microsoft.public.dotnet.framework.remoting)