Insert activity gives error "Insert: IErrorInfo.GetDescription failed with E_FAIL(0x80004005)."

Hi Guys,

I need some help with the Insert activity from the UIPath database package to make it run.
Whatever I try I get the error “Insert: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).”

As a test the setting is very simple:

The execute query connects to an Access .mdb with only 1 table and selects everything from a table, stores it in a DataTable named “FromMDB”

Then the insert activity just shall take all this from the DataTable and write it back into the Microsoft Access file to the same table.

I tried it with and without brackets [ & ] but the error stays the same.

Who can help me making this simple test setup working ?

Did you try insert into dbo.tablename?

The second thing to try is to develop the insert SQL in MS Access syntax and then use that in your Automation.

I find it easier to develop a stored proc and pass in parameters into it. The entire INSERT SQL would be canned inside this store proc.

Hi again
in the meantime I found out where this error is coming from.

The Access DB uses 2 headers (IN and Language) which are reserved words. Furthermore some of the tables are configured with ‘Allow zero length = no’ but contain empty cells.
I tested it by manually changing these settings and then it worked.

Thanks for replying, Andy. Unfortunately I´m (still) not skilled enough to understand what you´re pointing at.

Hopefully the finding described above helps other less skilled users like me to get a clue why this error pops up in such a constellation.

Hi @cs3e ,

“dbo” is an acronym for DataBase Owner. In some cases it is necessary to identify the objects by their owner name. By default if the current owner of the database creates objects inside of it, those objects would be recognized/qualified by their owner name.

Example:

insert into dbo.InvoiceHeader(invoice_number, invoice_date, invoice_amount,...)
select 123, 10/05/2021, 3456.78...

In my post yesterday, I was trying to articulate how your Insert query might look like in your Access Database. Here is an example from a standard MS Access Sample database.

To follow Steps 1 through 3:

  1. Right-click on Contacts Insert Query and select Design View
  2. When Design View opens up, select the SQL View from the View drop-down on the Top-left
  3. The Design will open up in bare-bones SQL view

From this you can ascertain how an Insert Query is modeled in MS Access.
With this information you can build your Insert SQL and save it as a named Query that you can then call from RPA and pass this query the inputs .

Imho, regardless of the scale of your database (MS Access or anything larger) a good way to separate RPA from the database is to keep things where they work best.

If you put in a raw INSERT SQL query in the Automation, you are tightly binding the Robot with your database which is not a good approach. This can lead to situations where you have to modify and redeploy your Robot each time you want to change something in the SQL.

Instead if you put contain everything within a canned Query on the Access side, your Robot does not have to change as long as the name of the Query and the I/O parameters you pass to it remain unchanged.

It’s a good practice to keep these considerations in mind as you build and enhance your applications.

1 Like

Hi @AndyMenon

sorry for my late reply and thanks for this detailed information! Got it now :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.