Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9

    Intermittent Error: Must use updateable query

    I have a legacy C# program that has been working for years. It runs on Windows Server 8. Connects to an .mdb via ace.oledb.12

    This is a small extract program that updates each divisions UPS shipping interface table - an .mdb



    This program runs as a scheduled task - every 1/2 hr. We have 3 divisions, each a separate task. Months ago, we moved two of the divisions to this server - all is well. This week I moved the third division. Same folder structure, as the other two, same config.

    Intermittently I'm getting "Operation must use an updateable query. I've Googled this and found it could be a question of permissions - but all the folders have the same permissions, additionally it works some times. The other two work fine.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    have you checked whether you have nulls in the data? nulls can cause errors which misleadingly can throw out this type of message

  3. #3
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9
    The program produces a log - when it fails - all orders in the batch fail. It's not nulls - this is all text.

    8/11/2016 10:15:02 AM -- 1 Sales Orders Appended
    8/11/2016 10:45:02 AM -- 0 Sales Orders Appended
    8/11/2016 11:15:03 AM -- 4 Sales Orders Appended
    8/11/2016 11:45:03 AM -- 1 Sales Orders Appended
    8/11/2016 12:15:09 PM -- 1 Sales Orders Appended
    8/11/2016 12:45:03 PM -- Operation must use an updateable query.
    Insert into shipto(so_nbr,so_cust,so_ship,ad_addr,ad_name,ad_l ine1,ad_line2,ad_city,ad_state,ad_zip,ad_type,ad_r ef,ad_sort,ad_country,ad_ext2,qry_time) Values('634984', '76392', 'HG0742', 'HG0742', 'HOMEGOODS #0742', '8700 PRESTON RD STE 111', 'PRESTON VILLIAGE SHP CTR', 'PLANO', 'TX', '75024', 'ship-to', '76392', 'HOMEGOODS #0742', 'United States', '450289', '2016/08/11 - 12:45:02')

  4. #4
    Bulzie is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Is shipto a table or query? If query can you provide the SQL code for it. Maybe something with the special characters in the data? So once it fails, you can rerun it immediately and it works?

  5. #5
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9
    It's a table. The C# calls a program that extracts the data into XML, passes it back to C#, and the C# updates the table. If I set the right flags, the extract program will pull it again, and it will update the .mdb just fine.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,424
    Operation must use an updateable query.
    So what is the query? Can you provide the sql?

    sorry - now see the sql, ignore my request!!
    Last edited by CJ_London; 08-11-2016 at 12:55 PM. Reason: sql provided

  7. #7
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9
    Here's the code. It creates this string and inserts each record:

    if (oXmlReader.NodeType == XmlNodeType.EndElement)
    {
    if (cText != "")
    {
    if (cFieldList == "")
    {
    cFieldList = "Insert into shipto(" + oXmlReader.Name.ToString();
    }
    else
    {
    cFieldList = cFieldList + "," + oXmlReader.Name.ToString();


    if (ltrace)
    {
    Console.WriteLine("#5 XML Data: " + oXmlReader.Name.ToString());
    }
    }
    }


    //Console.WriteLine(" {0}='{1}'", cField, cText);
    cText = "";


    if (oXmlReader.Name.ToString() == "shipto")
    {
    StringBuilder stb = new StringBuilder();


    try
    {
    cFieldList = cFieldList + ") ";
    cValuesList = cValuesList + ")";
    stb.Append(cFieldList.ToString());
    stb.Append(cValuesList.ToString());
    cFieldList = "";
    cValuesList = "";


    //Update the Access database
    iSoCount++ ;
    OleDbCommand cmd = con.CreateCommand();
    cmd.CommandText = stb.ToString();
    cmd.CommandType = CommandType.Text;
    cmd.ExecuteNonQuery();

    cmd.Dispose();
    }
    catch (Exception ex)
    {
    StreamWriter logSW;
    logSW = File.AppendText(sLogFile); // ConfigurationSettings.AppSettings["UPSlogFile"]);
    logSW.Write(DateTime.Now.ToString());
    logSW.Write(" -- ");
    logSW.WriteLine(ex.Message);
    logSW.Write(" ");
    logSW.WriteLine(stb);
    logSW.Close();
    }


    }
    }
    } //while (oXmlReader.Read())

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Can you show us the design of the ShipTo table.

    All field values appear to be text in your SQL.
    If your qry_time field is a Date data type, then you'll need # date time value#

  9. #9
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9
    All the fields are text. And as I said it has worked for years.

    Click image for larger version. 

Name:	UPS2QAD.jpg 
Views:	10 
Size:	125.7 KB 
ID:	25430

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Just curious --is there a Primary key defined on the ShipTo table?

    Here is a link (Read Only)that may be helpful.

    Potentially other users or processes using the database?

  11. #11
    Bulzie is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Do all 3 of your process run at the same time on the scheduler? Maybe something is locking that table?

  12. #12
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9
    First - I want to thank you guy's for helping!

    so_nbr is unique, all the fields are text.

    I changed the time in the task scheduler to run at 15 and 45 - the others run on the half hour. Did not help.

  13. #13
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

  14. #14
    Doug_B is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    9
    so-nbr is the primary key

    Click image for larger version. 

Name:	UPS_SO_NBR.jpg 
Views:	9 
Size:	46.8 KB 
ID:	25431

  15. #15
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 17
    Last Post: 08-11-2016, 08:26 AM
  2. intermittent #ERROR in subform detail
    By jr2014 in forum Forms
    Replies: 7
    Last Post: 09-03-2014, 07:30 PM
  3. Use updateable query error
    By looloo in forum Queries
    Replies: 8
    Last Post: 09-24-2011, 12:39 AM
  4. Replies: 3
    Last Post: 05-02-2011, 12:08 PM
  5. Replies: 0
    Last Post: 03-27-2010, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums