Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    why the code write from the line 30 .... (2000 )

    Admit have a blank data in field tre_1.
    And have thsi code to insert a new value in tre_1 e quattro_1 insetead to write from line 1 aof fileds the code write from the line 30????

    SQL = "SELECT * FROM GRADI WHERE TRE_1 = '" & TRE & "'"
    RS1.Open SQL, CNN
    If RS1.EOF = True Then
    'RS1.MoveFirst
    SQL = "INSERT INTO GRADI (TRE_1,QUATTRO_1)VALUES('" & TRE & "','" & QUATTRO & "')"
    CNN.Execute SQL
    End If

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: why the code write from the line 30 .... (2000 )

    The lines
    <code>
    SQL = "INSERT INTO GRADI (TRE_1,QUATTRO_1)VALUES('" & TRE & "','" & QUATTRO & "')"
    CNN.Execute SQL
    </code>
    have nothing to do with the recordset RS1. The SQL statement starts with INSERT INTO GRADI, i.e. it will add new records at the end of the table GRADI.

    If you want to update records where TRE_1 equals the variable TRE, you can use
    <code>
    SQL = "UPDATE GRADI SET QUATTRO_1='" & QUATTRO "' WHERE TRE_1='" & TRE & "'"
    CNN.Execute SQL
    </code>
    The recordset RS1 isn't used here either.

Posting Permissions

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