Support > Forums > OpenBots Studio > how to fix The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, version=4.0.0.0
Hello,
We are facing an issue adding bulkCopy.WriteToServer(vTableOrdenada) code in a evaluate snippet. The error is:
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, version=4.0.0.0.
vTableOrdenada is a Datatable.
We really appreciate your comments.
This forum has 317 topics, 688 replies, and was last updated 5 hours ago by Sainath S
Hello,
This is the script inside snippet:
String noLote = ""; String fecha = "";
DataColumn newCreationDate = new DataColumn("CREATION_DATE", typeof(DateTime)); DataColumn newCodAlmacen = new DataColumn("COD_ALMACEN", typeof(String)); DataColumn newCodId = new DataColumn("ID",typeof(int)); newCreationDate.DefaultValue = DateTime.Now; newCodAlmacen.DefaultValue = "CEDI01";
vTablaDatos.Columns.Add(newCreationDate); vTablaDatos.Columns.Add(newCodAlmacen); vTablaDatos.Columns.Add(newCodId); vTablaDatos.Columns["Expira"].DataType = typeof(String);
vTableOrdenada.Columns.Add("ID",typeof(int)); vTableOrdenada.Columns.Add("CREATION_DATE",typeof(DateTime)); vTableOrdenada.Columns.Add("COD_ALMACEN",typeof(String)); vTableOrdenada.Columns.Add("CODIGO_PRODUCTO",typeof(String)); vTableOrdenada.Columns.Add("NRO_LOTE",typeof(String)); vTableOrdenada.Columns.Add("FECHA_EXPIRA",typeof(DateTime));
foreach(DataRow row in vTablaDatos.Rows)
{
DataRow newRow = vTableOrdenada.NewRow();
if (row["Lote"].ToString() != "Total")
{
newRow["ID"] = row["ID"];
newRow["CREATION_DATE"] = row["CREATION_DATE"];
newRow["COD_ALMACEN"] = row["COD_ALMACEN"];
newRow["CODIGO_PRODUCTO"] = row["Codigo"];
if (row["Lote"].ToString() != "")
{
newRow["NRO_LOTE"] = row["Lote"];
noLote = row["Lote"].ToString();
}
else
{
newRow["NRO_LOTE"] = noLote;
}
String idate = row["Expira"].ToString();
//MessageBox.Show(idate);
if (idate != "")
{
DateTime ifecha = DateTime.Parse(idate);
newRow["FECHA_EXPIRA"] = ifecha;
fecha = idate;
}
else
{
DateTime ifecha = DateTime.Parse(fecha);
newRow["FECHA_EXPIRA"] = ifecha;
}
vTableOrdenada.Rows.Add(newRow);
}
}
var connection = new Oracle.DataAccess.Client.OracleConnection(vConexion); connection .Open(); Oracle.DataAccess.Client.OracleBulkCopy bulkCopy = new Oracle.DataAccess.Client.OracleBulkCopy(connection); bulkCopy.DestinationTableName = "CMS_WMS_LOTES_EXPIRAS"; bulkCopy.WriteToServer(vTableOrdenada); connection .Close();
Hi ti-distribucion,
Thanks for submitting your support request.
This type of error usually indicates that your code snippet is missing a declaration, in this case the vTableOrdenada needs to be defined. using (SqlBulkCopy bulkCopy = new SqlBulkCopy(""))
If you can share the sample script/code snippet you are attempting to execute, we can take a closer look.
Thanks!
You are not authorized to reply, please click here to login and add your reply to this topic.