Re: inserting data problem with something having to be declared

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

  • Next message: Triptaz: "Re: inserting data problem with something having to be declared"
    Date: Sat, 19 Mar 2005 09:37:04 -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
    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 i am using
            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)
    Still telling me that this "[Booth Number]" is not declared can someone tell
    me what im doing wrong or what i am misssing. tried the solution that was
    given to me and did not work [Booth Number] is a table in my database am i
    writing it wrong or am i forgetting something. i have tried other tables in
    the database and im still getting this error about it not being declared
            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...
    > >
    > >
    > >


  • Next message: Triptaz: "Re: inserting data problem with something having to be declared"

    Relevant Pages

    • Re: What is Pick anyway?
      ... POSTALCODE, CITY and STATE. ... >>> the scenario as typical of database work. ... >> programs, Datastage, uses Universe as its engine. ...
      (comp.databases.theory)
    • Re: How long for teleporters to replace airliners?
      ... costs for something that most of the residents would never use. ... I can easily see every big city to have there ... Note that my original response assumed any booth could connect to any ... teleport to the airport, that'd be a lot easier and faster. ...
      (rec.arts.sf.science)
    • Re: mysql update/replace syntax
      ... Information about a patient in a database makes that database legally ... sender to good addresses, ... You DO NOT want to record each email: this allows spammers to ... >what day which fruit sells best. ...
      (comp.lang.php)
    • Internal Passport Database - Additional records added
      ... 4,000 records from the city of Kaunas, and 550 records from the city of ... have been added to the Lithuania Internal Passport Database. ... though the internal passport was applied for in Kaunas or in Panevezys, ...
      (soc.genealogy.jewish)
    • Network Monitoring System
      ... Basically there are 3 programs and a database; ... a database loader on the receiving machine. ... The sender process on that machine is quietly waiting for data in the file ... generate a nice html page using simple php scripts. ...
      (comp.os.linux.misc)