• speed to write in access database…

    Author
    Topic
    #464076

    Clear me please…
    In order of speeding wath is the best command with ado conn:

    rs.addnew

    rs.update

    or sql “insert ecc….”
    cnn.execute sql

    tks

    Viewing 1 reply thread
    Author
    Replies
    • #1186766

      If you’re adding a single record, you won’t notice any difference.
      A SQL statement with INSERT INTO can add many records at once, so if you need to add multiple records, executing a SQL statement will be faster.

      • #1186768

        If you’re adding a single record, you won’t notice any difference.
        A SQL statement with INSERT INTO can add many records at once, so if you need to add multiple records, executing a SQL statement will be faster.

        ok i use INSRET INTO….

      • #1186769

        If you’re adding a single record, you won’t notice any difference.
        A SQL statement with INSERT INTO can add many records at once, so if you need to add multiple records, executing a SQL statement will be faster.

        Error different number of fileds and value in query!!!!! why???

        Code:
        ''''''''''''''''
            Set CN1 = New ADODB.Connection
            CN1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:EPFOperativita_Sportello_Mag_07_Oggi.mdb;"
        
        '''''''''''''''''
          
                    SQL = "INSERT INTO L1262 " & _
                "([DATA_RIF], [AGENZIA_CENTRO], [SEGM], [C_OPER], [MS],[MERC], [TOT_OPE], [TOT_PEZ], [TOT_IMPORTO]) " & _
                " VALUES (" & _
                "'" & DATA_RIF & "', " & _
                "'" & SPORT & "', " & _
                "'" & SEGM & "', " & _
                "'" & C_OPER & "', " & _
                "'" & MS & "'" & _
                "'" & MERC & "', " & _
                "'" & TOT_OP & "', " & _
                "'" & TOT_PZ & "'" & _
                "'" & TOT_IMP & "'" & _
                ")"
                        CN1.Execute (SQL)
        
        • #1186770

          You should only place quotes ‘ around text values. From your screenshot, I get the impression that C_OPER, TOT_OP, TOT_PZ and TOT_IMP are number or currency values, so you should not place quotes around those.

          • #1186771

            You should only place quotes ‘ around text values. From your screenshot, I get the impression that C_OPER, TOT_OP, TOT_PZ and TOT_IMP are number or currency values, so you should not place quotes around those.

            Yes are number….
            Example for the last 3 value?

            • #1186772

              Yes are number….
              Example for the last 3 value?

              Just remove the single quotes for those fields.

    • #1187674

      In order of speeding wath is the best command with ado conn:

      rs.addnew

      rs.update

      or sql “insert ecc….”
      cnn.execute sql

      Take a look at disconnected ADO recordsets. What this allows you to do is create the recordset, disconnect it from its source, update it with .addnew or .update as you wish with no impact on the database, reconnect it to its source and apply all your changes in one hit. This gives you very powerful functionality which, in most cases, will be much preferable to the “INSERT INTO” syntax as you will have complete control over the data added or updated.

    Viewing 1 reply thread
    Reply To: speed to write in access database…

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: