I am trying to format an Excel 2010 doc and the file creates fine and the data is there, but when the script task goes to format the file it gets corrupted. I have also noticed that it will only read the first of 2 worksheets. Here is the code:
Dim lintLastRow As Integer
Dim lstrLastCol, lstrHeader As String
Dim mobjWorkbook As Workbook
Dim mappExcel As New Microsoft.Office.Interop.Excel.Application
Dim lobjWorksheet As Worksheet
Dim emptyBytes(0) As Byte
Dim oldCI As System.Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
Try
mappExcel.Visible = False
mappExcel.DisplayAlerts = False
mappExcel.AskToUpdateLinks = False
mappExcel.AlertBeforeOverwriting = False
mobjWorkbook = mappExcel.Workbooks.Open(Dts.Variables("FilePath").Value + Dts.Variables("FileName").Value)
mobjWorkbook.RefreshAll()
Dts.Log("worksheet count: " & mobjWorkbook.Sheets.Count, 0, emptyBytes)
For Each lobjWorksheet In mobjWorkbook.Sheets
If lobjWorksheet.Name = "Compare" Then
lstrLastCol = "T"
lstrHeader = "- Compare Results"
Else
lstrLastCol = "H"
lstrHeader = "- Trans UnMatch"
End If
'Dts.Log("Set worksheet: " & lintCount, 0, emptyBytes)
'lobjWorksheet = mobjWorkbook.Sheets.Item(lintCount)
Dts.Log("worksheet select", 0, emptyBytes)
lobjWorksheet.Select()
lobjWorksheet.Range("A1").Select()
If lobjWorksheet.Cells(2, 1).value = Nothing Then
lintLastRow = 4
Else
lobjWorksheet.Application.Cells.End(XlDirection.xlDown).Select()
lintLastRow = lobjWorksheet.Application.ActiveCell.Row + 2
End If
Dts.Log("last row: " & lintLastRow, 0, emptyBytes)
lobjWorksheet.Rows(1).Insert(XlInsertShiftDirection.xlShiftDown, False)
lobjWorksheet.Rows(1).Insert(XlInsertShiftDirection.xlShiftDown, False)
lobjWorksheet.Cells(1, 1).value = "PAM - GL Portfolio Level " + lstrHeader + " for " + Today
lobjWorksheet.Range("A1", lstrLastCol + "1").Merge()
lobjWorksheet.Range("A1").RowHeight = 27
lobjWorksheet.Range("A1", lstrLastCol + "3").Font.Bold = True
lobjWorksheet.Range("C4", lstrLastCol & lintLastRow).NumberFormat = "0.00" ' = FormatNumber("#####.00").
lobjWorksheet.Range("A3", lstrLastCol & lintLastRow).EntireColumn.AutoFit()
lobjWorksheet.Range("A1", lstrLastCol & lintLastRow).Font.Name = "Arial"
lobjWorksheet.Range("A1").Select()
Dts.Log("Complete Update", 0, emptyBytes)
Next
mobjWorkbook.Sheets("Compare").Select()
Dts.TaskResult = ScriptResults.Success
Catch ex As Exception
Dts.Events.FireError(0, "Format Excel Failed: ", _
ex.Message & ControlChars.CrLf & ex.StackTrace, _
String.Empty, 0)
Dts.TaskResult = ScriptResults.Failure
Finally
System.Threading.Thread.CurrentThread.CurrentCulture = oldCI
mobjWorkbook.Save()
mobjWorkbook.Close()
ReleaseCom(lobjWorksheet)
ReleaseCom(mobjWorkbook)
mappExcel.Quit()
ReleaseCom(mappExcel)
GC.Collect()
GC.WaitForPendingFinalizers()
End Try
This works fine on my machine and a pilot environment. When it goes to production things go downhill quick. Any thoughts on what I am missing would be great.
Thanks
So the original issue I believe was caused by the Excel converter not being installed on the server. Once that was install, I started to get the following error:
OnError,PGIDSMSQL045,PRINCIPALUSA\TWSPGIAC,Formate Excel,{610A1615-E16E-4B62-8A93-F692A478FCF9},{EF8F3734-6467-423C-A9D3-BF2463EEFD44},04/18/2013 11:52:09 AM,04/18/2013 11:52:09 AM,0,0x,The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at ST_0391e3bc80224a34819c14be208559c5.vbproj.ScriptMain.Main()
OnError,PGIDSMSQL045,PRINCIPALUSA\TWSPGIAC,PAM-GLPortLvlRecon,{008D2838-612E-4DBB-AEE7-65145ED0BAAC},{EF8F3734-6467-423C-A9D3-BF2463EEFD44},04/18/2013 11:52:09 AM,04/18/2013 11:52:09 AM,0,0x,The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at ST_0391e3bc80224a34819c14be208559c5.vbproj.ScriptMain.Main()
OnError,PGIDSMSQL045,PRINCIPALUSA\TWSPGIAC,Formate Excel,{610A1615-E16E-4B62-8A93-F692A478FCF9},{EF8F3734-6467-423C-A9D3-BF2463EEFD44},04/18/2013 11:52:09 AM,04/18/2013 11:52:09 AM,8,0x,The script returned a failure result.
OnError,PGIDSMSQL045,PRINCIPALUSA\TWSPGIAC,PAM-GLPortLvlRecon,{008D2838-612E-4DBB-AEE7-65145ED0BAAC},{EF8F3734-6467-423C-A9D3-BF2463EEFD44},04/18/2013 11:52:09 AM,04/18/2013 11:52:09 AM,8,0x,The script returned a failure result.
OnError,PGIDSMSQL045,PRINCIPALUSA\TWSPGIAC,Formate Excel,{610A1615-E16E-4B62-8A93-F692A478FCF9},{EF8F3734-6467-423C-A9D3-BF2463EEFD44},04/18/2013 11:52:09 AM,04/18/2013 11:52:09 AM,1,0x,System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at ST_0391e3bc80224a34819c14be208559c5.vbproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
OnError,PGIDSMSQL045,PRINCIPALUSA\TWSPGIAC,PAM-GLPortLvlRecon,{008D2838-612E-4DBB-AEE7-65145ED0BAAC},{EF8F3734-6467-423C-A9D3-BF2463EEFD44},04/18/2013 11:52:09 AM,04/18/2013 11:52:09 AM,1,0x,System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at ST_0391e3bc80224a34819c14be208559c5.vbproj.ScriptMain.Main()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()
This has been more fun then I ever wanted...but a good challange.
I have check the variables and they have the correct information. The user has full access to the output directory because it creates the file in earlier steps. So I am not sure what I am missing. Note: This whole process works when it was formatting an .xls file so I am not sure what is going on with .xlsx.
thanks
The converter was installed and must have needed a reboot because the server was rebooted this weekend and everything seems to be working. So I think we are good now.
Related
I added a custom field for vendorid on the SO Line. (Yes, I know there is one there, but we are building some new logic). I've added the integer field and it appears on the grid fine. I'm trying to get a lookup of vendors. I started with this
Where<AP.Vendor.type, NotEqual<BAccountType.employeeType>>>))]
and then tried
Where<BAccountR.type, Equal<BAccountType.companyType>,
Or<AP.Vendor.type, NotEqual<BAccountType.employeeType>>>>),
Visibility = PXUIVisibility.SelectorVisible, CacheGlobal = true, Filterable = true)]
It got me a lookup on new records, but then when I save and try to open any sales order, I get an error that says "Error: An error occurred during the processing of the field InventoryID: Specified cast is not valid.." which makes no sense to me. But if I remove the above it works, so seems like that must be the issue.
Stack Trace as requested:
Error: Error: An error occurred during processing of the field InventoryID: Specified cast is not valid..
Raised At: 2/24/2020 6:47:58 PM Screen: SO.30.10.00
Details:
2/24/2020 6:47:58 PM Error:
Error: An error occurred during processing of the field InventoryID: Specified cast is not valid..
System.InvalidCastException: Specified cast is not valid.
at System.Data.SqlClient.SqlBuffer.get_Int32()
at PX.Data.PXDataRecord.GetInt32(Int32 i)
at PX.Data.PXDBIntAttribute.RowSelecting(PXCache sender, PXRowSelectingEventArgs e)
at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly)
at PX.Data.PXCache.OnRowSelecting(Object item, PXDataRecord record, Int32& position, Boolean isReadOnly)
at PX.Data.PXCache`1.Select(PXDataRecord record, Int32& position, Boolean isReadOnly, Boolean& wasUpdated)
at PX.Data.PXView.GetResult(Object[] parameters, PXFilterRow[] filters, Boolean reverseOrder, Int32 topCount, PXSearchColumn[] sorts, Boolean& overrideSort, Boolean& extFilter)
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Objects.SO.SOOrderEntry.transactions()
at _CustomMethod(Object , Object[] )
at PX.Data.PXView.InvokeDelegate(Object[] parameters)
at PX.Data.PXView.Select(Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
at PX.Data.PXGraph.ExecuteSelect(String viewName, Object[] currents, Object[] parameters, Object[] searches, String[] sortcolumns, Boolean[] descendings, PXFilterRow[] filters, Int32& startRow, Int32 maximumRows, Int32& totalRows)
Anyone have any thoughts?
TL;DR;
Remove PXDBInt attribute from the field.
The issue here is not with Where condition but with attributes definition for the field.
[PXDBInt]
[PXUIField(DisplayName="Vendor ID")]
[AP.Vendor(typeof(Search<BAccountR.bAccountID, Where<AP.Vendor.type,
NotEqual<BAccountType.employeeType>>>))]
Actually, here you have DBField attribute twice. You have PXDBIntAttribute and Vendor attribute that contains PXDBIntAttribute inside.
Because of that the framework has the wrong fields to db columns mapping resulting in that strange error.
If you use Visual studio, I recommend you to try Acuminator extension https://marketplace.visualstudio.com/items?itemName=Acumatica.Acuminator
It highlights that type of errors
Too long for a comment, but more of a suggestion than an "answer". Try building your own PXSelector. I have a custom DAC that needs to store two vendors, and I had to abandon the AP.Vendor attribute for a custom PXSelector for mine to work. This is one of mine. In my case, I need to be able to see which one is defined as the Preferred Vendor for the warehouse, and I only want to see vendors associated with my InventoryID. SSINItemBranch is a custom DAC that is also available in the scope of this DAC's usage. The point is, use this as an example if you need one to try creating your own from scratch. If this isn't how you want to accomplish the task, at least you might isolate if the problem is a use case of the AP.Vendor attribute or something else.
[PXSelector(
typeof(Search2<
Vendor.bAccountID,
InnerJoin<POVendorInventory,
On<POVendorInventory.vendorID, Equal<Vendor.bAccountID>,
And<POVendorInventory.inventoryID, Equal<Current<SSINItemBranch.inventoryID>>>>,
LeftJoin<INItemSite, On<INItemSite.inventoryID, Equal<POVendorInventory.inventoryID>,
And<INItemSite.preferredVendorID, Equal<POVendorInventory.vendorID>,
And<INItemSite.preferredVendorLocationID, Equal<POVendorInventory.vendorLocationID>,
And<INItemSite.preferredVendorOverride, Equal<True>>>>>>>,
Where<Vendor.type, Equal<BAccountType.vendorType>>>),
typeof(Vendor.acctCD),
typeof(Vendor.acctName),
typeof(POVendorInventory.vendorLocationID),
typeof(INItemSite.preferredVendorOverride),
typeof(POVendorInventory.vendorInventoryID),
typeof(POVendorInventory.vLeadTime),
SubstituteKey = typeof(Vendor.acctCD),
DescriptionField = typeof(Vendor.acctName),
Filterable = true
)]
I am trying to learn SparkCLR to process a text file and run a Spark SQL query on it using a Sample like below:
[Sample]
internal static void MyDataFrameSample()
{
var schemaTagValues = new StructType(new List<StructField>
{
new StructField("tagname", new StringType()),
new StructField("time", new LongType()),
new StructField("value", new DoubleType()),
new StructField("confidence", new IntegerType()),
new StructField("mode", new IntegerType())
});
var rddTagValues1 = SparkCLRSamples.SparkContext.TextFile(SparkCLRSamples.Configuration.GetInputDataPath(myDataFile))
.Map(r => r.Split('\t')
.Select(s => (object)s).ToArray());
var dataFrameTagValues = GetSqlContext().CreateDataFrame(rddTagValues1, schemaTagValues);
dataFrameTagValues.RegisterTempTable("tagvalues");
//var qualityFilteredDataFrame = GetSqlContext().Sql("SELECT tagname, value, time FROM tagvalues where confidence > 85");
var qualityFilteredDataFrame = GetSqlContext().Sql("SELECT * FROM tagvalues");
var data = qualityFilteredDataFrame.Collect();
var filteredCount = qualityFilteredDataFrame.Count();
Console.WriteLine("Filter By = 'confidence', RowsCount={0}", filteredCount);
}
but this keeps giving me the error that says:
[2016-01-13 08:56:28,593] [8] [ERROR] [Microsoft.Spark.CSharp.Interop.Ipc.JvmBridge] - JVM method execution failed: Static method collectAndServe failed for class org.apache.spark.api.python.PythonRDD when called with 1 parameters ([Index=1, Type=JvmObjectReference, Value=19], )
[2016-01-13 08:56:28,593] [8] [ERROR] [Microsoft.Spark.CSharp.Interop.Ipc.JvmBridge] -
*******************************************************************************************************************************
at Microsoft.Spark.CSharp.Interop.Ipc.JvmBridge.CallJavaMethod(Boolean isStatic, Object classNameOrJvmObjectReference, String methodName, Object[] parameters) in d:\SparkCLR\csharp\Adapter\Microsoft.Spark.CSharp\Interop\Ipc\JvmBridge.cs:line 91
*******************************************************************************************************************************
my text file looks like below:
10PC1008.AA 130908762000000000 7.059829 100 0
10PC1008.AA 130908762050000000 7.060376 100 0
10PC1008.AA 130908762100000000 7.059613 100 0
10PC1008.BB 130908762150000000 7.059134 100 0
10PC1008.BB 130908762200000000 7.060124 100 0
Is there something wrong in the way I am using this?
Edit 1
I have set the following as my Samples project properties:
my User Environmentalvariable is as below:(not sure if that matters)
Also what i see in SparkCLRWorker log that its unable to load the assembly as per the logs:
[2016-01-14 08:37:01,865] [1] [ERROR] [Microsoft.Spark.CSharp.Worker] - System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.FileNotFoundException: Could not load file or assembly 'SparkCLRSamples, Version=1.5.2.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Runtime.Serialization.FormatterServices.LoadAssemblyFromString(String assemblyName)
at System.Reflection.MemberInfoSerializationHolder..ctor(SerializationInfo info, StreamingContext context)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.SerializationInvoke(IRuntimeMethodInfo method, Object target, SerializationInfo info, StreamingContext& context)
at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at Microsoft.Spark.CSharp.Worker.Main(String[] args) in d:\SparkCLR\csharp\Worker\Microsoft.Spark.CSharp\Worker.cs:line 149
Did you specify the sample data location and copy your source text file to that location? If not you can refer to
https://github.com/Microsoft/SparkCLR/blob/master/csharp/Samples/Microsoft.Spark.CSharp/samplesusage.md
to set your sample data location with argument [--data | sparkclr.sampledata.loc].
Try explicitly setting [--temp | spark.local.dir] option (see sampleusage.md for more info on supported arguments) when you run your code. SparkCLR worker executable gets downloaded into this directory at the time of execution. If you use default temp directory, there is a possibility that the worker executable will get quarantined by your anti-virus software mistaking it for some malicious program downloaded by your browser. Overriding the default value to something like c:\temp\SparkCLRTemp will help avoiding that problem.
If setting temp directory does not help, share the entire commandline argument list you are using when launching SparkCLR driver code.
this is how you change the port number, I hope this helps
in App.config add the following
for the sake of completeness, you must also add the tag that specifies the path to the csharpworker
<appSettings>
<add key="CSharpBackendPortNumber" value="num"/>
<add key="CSharpWorkerPath" value="C:\MobiusRelease\samples\CSharpWorker.exe"/>
</appSettings>
notice, to make this work in debug mode you should first run this command using command line,
from the (mobius home) directory
%SPARKCLR_HOME%\scripts
run
sparkclr-submit.cmd debug
this will give you a message like this that contains a port number
[CSharpRunner.main] Port number used by CSharpBackend is 5567
* [CSharpRunner.main] Backend running debug mode. Press enter to exit *
Windows 10, VS2013 professional
Window phone silverlight 8.1 application.
The error is:
The "GenerateResource" task failed unexpectedly.
System.InvalidOperationException: Item named 'xamls/simplelogin.xaml' of type 'System.IO.UnmanagedMemoryStream' cannot be added to the resource file because it is not serializable.
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo reader, IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo reader, String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFileOrDir)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 satelliteInputs, List`1 outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass, Boolean extractingResWFiles, String resWOutputDirectory)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 satelliteInputs, List`1 outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass, Boolean extractingResWFiles, String resWOutputDirectory)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() CarManagerWpApp
When i remove the "Microsoft.Sharepoint.Client.Phone.Auth.UI" reference, everything is allright. Unfortunately, this dll is crutial for me. I have seen a lot of 'The "GenerateResource" task failed unexpectedly' errors on net, none of solutions helped me.
Anyone has any idea? Thank you
EzApi is used to create SSIS package, package reads excel file through oledb connection manager(microsoft.ace.oledb.12.0) When i create EzExecSQLTask object after dataflow that reads the excel file,
i got the exception : object does not match the target type
After Debugging the EzApi code i found below line is generating the exception
host.Properties["TimeOut"].SetValue(host, value);
it seemed that when the property is set through reflection it doesn't find the target object.
Code works fine on widows xp machine , but on windows Server 2012 its causing the issue.
stack trace
at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at Microsoft.SqlServer.Dts.Runtime.ManagedHelper.ManagedPropertyHelper.SetPropertyValue(Object o, Int32 index, Object value)
at Microsoft.SqlServer.Dts.Runtime.DtsProperty.SetValue(Object o, Object value)
at Microsoft.SqlServer.SSIS.EzAPI.EzExecSqlTask.set_TimeOut(UInt32 value) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\EzExecutables.cs:line 751
at Microsoft.SqlServer.SSIS.EzAPI.EzExecSqlTask.InitializeTask() in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\EzExecutables.cs:line 740
at Microsoft.SqlServer.SSIS.EzAPI.EzExecSqlTask..ctor(EzContainer parent) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\EzExecutables.cs:line 732
at Microsoft.SqlServer.SSIS.EzAPI.Common.ComponentWrapper.CreateSQLTaskWithExpression(EzContainer p, String name, String sql, EzConnectionManager cm) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\Common\ComponentWrapper.cs:line 55
at Microsoft.SqlServer.SSIS.EzAPI.SSI_Wrapper.SSIPackage.LogMessage(String stepID, String stepName, String userID, String statusID, String message, String sqlTaskName, EzExecutable attachToComp, EzConnectionManager cm) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\SSI Wrapper\SSIPackage.cs:line 723
at Microsoft.SqlServer.SSIS.EzAPI.SSI_Wrapper.SSIPackage.CreatePackage(Int64 userID, Nullable`1 sourceID, Int64 taskID, Boolean isSystemTask, StepDTO step, List`1 execStatus) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.EzApi\SSI Wrapper\SSIPackage.cs:line 178
at Optime.ISS.ETL.WebAPI.SSISPackageController.ExecuteTask(TaskDTO task) in d:\ROI_ETL\ROi\ETL\Optime.ISS.ETL.WebAPI\SSISPackageController.cs:line 77
More Information
Issue occured only on windows server 2012 when microsoft.ace.oledb.12.0 is used to connect to excel file. Same code works fine in window xp with microsoft.ace.oledb.12.0 32 bit drivers
please help.... we can move any further.
please suggest right forum.
I'm using Linq to NHibernate and I have a need to find all records with a column ("BusinessName") that start with a number.
My first thought was something like this:
var numbers = Enumerable.Range(0, 10).Select(x => x.ToString()).ToList();
query = query.Where(x=>numbers.Contains(x.BusinessName.Substring(0,1)));
But I'm getting the exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetEntityName(ICriteria subcriteria, String propertyName)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetType(ICriteria subcriteria, String propertyName)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetTypeUsingProjection(ICriteria subcriteria, String propertyName)
at NHibernate.Criterion.InExpression.AssertPropertyIsNotCollection(ICriteriaQuery criteriaQuery, ICriteria criteria)
at NHibernate.Criterion.InExpression.ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery, IDictionary`2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaQueryTranslator.GetWhereCondition(IDictionary`2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaJoinWalker..ctor(IOuterJoinLoadable persister, CriteriaQueryTranslator translator, ISessionFactoryImplementor factory, ICriteria criteria, String rootEntityName, IDictionary`2 enabledFilters)
at NHibernate.Loader.Criteria.CriteriaLoader..ctor(IOuterJoinLoadable persister, ISessionFactoryImplementor factory, CriteriaImpl rootCriteria, String rootEntityName, IDictionary`2 enabledFilters)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List()
at NHibernate.Impl.CriteriaImpl.UniqueResult()
at NHibernate.Linq.Visitors.ImmediateResultsVisitor`1.HandleAggregateCall(MethodCallExpression call)
at NHibernate.Linq.Visitors.ImmediateResultsVisitor`1.VisitMethodCall(MethodCallExpression call)
at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
at NHibernate.Linq.Visitors.NHibernateExpressionVisitor.Visit(Expression exp)
at NHibernate.Linq.Visitors.ImmediateResultsVisitor`1.GetResults(MethodCallExpression expr)
at NHibernate.Linq.Visitors.RootVisitor.HandleImmediateResultsCall(MethodCallExpression call)
at NHibernate.Linq.Visitors.RootVisitor.VisitMethodCall(MethodCallExpression expr)
at NHibernate.Linq.Visitors.ExpressionVisitor.Visit(Expression exp)
at NHibernate.Linq.Visitors.NHibernateExpressionVisitor.Visit(Expression exp)
at NHibernate.Linq.Visitors.NHibernateQueryTranslator.TranslateInternal(Expression expression)
at NHibernate.Linq.Visitors.NHibernateQueryTranslator.Translate(Expression expression, QueryOptions queryOptions)
at NHibernate.Linq.NHibernateQueryProvider.TranslateExpression(Expression expression)
at NHibernate.Linq.NHibernateQueryProvider.Execute(Expression expression)
at NHibernate.Linq.QueryProvider.System.Linq.IQueryProvider.Execute[T](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at SBON.ApiWrapper.SearchBusinesses(Nullable`1 id, String filter, String type, String letter, Nullable`1 start, Nullable`1 count) in D:\Data\Projects\Active\Clients\OfficeDepotSBON\src\SBON\ApiWrapper.cs:line 313
at SBONWeb.Controllers.MobileController.SearchBusinesses(String letter, String filter, Nullable`1 start, Nullable`1 count) in D:\Data\Projects\Active\Clients\OfficeDepotSBON\src\SBONWeb\Controllers\MobileController.cs:line 38
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
I don't really understand the exception, but I assume it has something to do with my use of substring to try match the first character against a list of numbers, since I can do the following without issue:
var numbers = Enumerable.Range(0, 10).Select(x => x.ToString()).ToList();
query = query.Where(x=>numbers.Contains(x.BusinessName));
How would you do this? Optimally I'm looking for a LINQ query that will work, but I might be able to resort to using an NHibernate named query (stored proc) if that's the only way to do this.
Bump for the Monday crowd.
This should do the trick
query = query.Where(x => char.IsNumber(x.BusinessName[0]));