Results 1 to 2 of 2

Thread: Sql...INSERT QUERY (not inserting...)

  1. #1

    Thread Starter
    Lively Member Dr_Evil's Avatar
    Join Date
    Mar 2000
    Location
    Columbus, OH
    Posts
    105
    I am attempting to write an insert query but can't find any good references. It's saying I have a syntax error in the INSERT statement but I'm not seeing it. If someone could take a look at this or let me know of any decent examples or references. Thanks in advance...
    Code:
     "INSERT INTO `Rotap` (`Sample Number`, `Sample Weight`, `Sieve1`, `Sieve2`, `Sieve3`, `Sieve4`, `Sieve5`," & _
                  "`ON1`, `ON2`, `ON3`, `ON4`, `ON5`, `THRU1`, `THRU2`, `THRU3`, `THRU4`, `THRU5`, `Bottom`,`Tested By`, `Date Tested`" & _
          "VALUES '" & txtSN.Text & "', '" & txtSW.Text & "', '" & cbo1.Text & "', '" & cbo2.Text & "', '" & cbo3.Text & "'," & _
                  "'" & cbo4.Text & "', '" & cbo5.Text & "', '" & txt1ON.Text & "', '" & txt2ON.Text & "', '" & txt3ON.Text & "'," & _
                  "'" & txt4ON.Text & "', '" & txt5ON.Text & "', '" & txt1THRU.Text & "', '" & txt2THRU.Text & "', '" & txt3THRU.Text & "'," & _
                  "'" & txt4THRU.Text & "', '" & txt5THRU.Text & "', '" & txtBP.Text & "', '" & txtTestedBy1.Text & "', '" & txtDateTested.Text & "'"
    Dr_Evil
    Senior Programmer
    VS6 EE
    VS.NET EA

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Try this

    Code:
    "INSERT INTO Rotap ([Sample Number], [Sample Weight], Sieve1, Sieve2, Sieve3, Sieve4, Sieve5," & _
                  "ON1, ON2, ON3, ON4, ON5, THRU1, THRU2, THRU3, THRU4, THRU5, Bottom,[Tested By], [Date Tested])" & _
          "VALUES ('" & txtSN.Text & "', '" & txtSW.Text & "', '" & cbo1.Text & "', '" & cbo2.Text & "', '" & cbo3.Text & "'," & _
                  "'" & cbo4.Text & "', '" & cbo5.Text & "', '" & txt1ON.Text & "', '" & txt2ON.Text & "', '" & txt3ON.Text & "'," & _
                  "'" & txt4ON.Text & "', '" & txt5ON.Text & "', '" & txt1THRU.Text & "', '" & txt2THRU.Text & "', '" & txt3THRU.Text & "'," & _
                  "'" & txt4THRU.Text & "', '" & txt5THRU.Text & "', '" & txtBP.Text & "', '" & txtTestedBy1.Text & "', '" & txtDateTested.Text & "')"
    A generic INSERT statement looks like

    Code:
    INSERT into tblName (field1,field2) VALUES('" & text1.text & "','" & text2.text & "'"
    Hope this helps

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width