Insert Table ERROR

Hi to all,
error, which I don’t understand, when I upload a datatable to DB.
After reading an excel sheet, and assigning some variables, with conditions, I try to insert everything on DB.
This is the error I see:
image

In Details:
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
*System.Data.Odbc.OdbcException: *

*Server stack trace: *

  • at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)*
  • at System.Data.Odbc.OdbcParameter.Bind(OdbcStatementHandle hstmt, OdbcCommand command, Int16 ordinal, CNativeBuffer parameterBuffer, Boolean allowReentrance)*
  • at System.Data.Odbc.OdbcParameterCollection.Bind(OdbcCommand command, CMDWrapper cmdWrapper, CNativeBuffer parameterBuffer)*
  • at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object methodArguments, SQL_API odbcApiMethod)*
  • at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)*
  • at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()*
  • at UiPath.Database.DatabaseConnection.Execute(String sql, Dictionary`2 parameters, Int32 commandTimeout, CommandType commandType)*
  • at UiPath.Database.Activities.ExecuteNonQuery.<>c__DisplayClass38_0.b__0()*
  • at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object args, Object server, Object& outArgs)*
  • at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)*

*Exception rethrown at [0]: *

  • at UiPath.Database.Activities.ExecuteNonQuery.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)*
  • at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)*
  • at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)*

Has anyone ever seen this error? I don’t understand what’s wrong with it.
If I try to write the table on another Excel sheet, the output seems correct to me.

@AaronMark

Check below thread for your reference

Hope this will help you

Thanks

Hello Srini84
I’ll be honest, I had already read that thread.
In the example you suggested, however, it is clear that the error is related to column 1. Perhaps absent … or with incorrect formatting…

In my case, it seems more complex. (at least, for me).
It appears to be related to ODBC.
my bot already uses odbc to connect to the db, and until the import on database step, it did not detect errors.
I tried the DB connection TEST, and it seems to work.
I really don’t know what it can be.

@AaronMark

So, Can you cross check the Insert Query you have used? also check the parameters you are passing are correct

Hope this may help you

Thanks

Match the columns count and columns data type in DB table and dt.

I update for the community, in case someone else gets into this specific mistake.
I solved it myself.

Reading the error logs, it catches my attention, the fact that it refers to ODBC Connection:
" * at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)*"
So I went through my ODBC settings and tried to create a different connector type.

I understand that the “ANSI DRIVER” connector does not work as a “unicode driver”.
I am not so experienced as to understand the difference, but by creating the SERVER_PRE as unicode, my flow started working correctly.

image

I hope my experience will be useful to someone.

Aaron

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