Results 1 to 8 of 8
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    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....

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    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:\EPF\Operativita_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)

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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.

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    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?

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Quote Originally Posted by sal21 View Post
    Yes are number....
    Example for the last 3 value?
    Just remove the single quotes for those fields.

  8. #8
    New Lounger
    Join Date
    Dec 2009
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

Posting Permissions

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