Dynamics Solomon Customization - microsoft-dynamics

My company wants me to create a custom screen in solomon to load some data from a table in the database.
They said used visual studio .net and i see manuals it says use VBA.
What should I use? VBA or visual studio 5?
How do I create a new application?

We got similar request from our customer. We're using Dynamics Solomon 2011. After doing some research, we found that we will need to create a development environment by installing VS 2008 first and then install Solomon over it. Installing Solomon after VS will setup some project templates in Visual Studio for Solomon development.
https://community.dynamics.com/product/sl/f/35/t/80585.aspx
There is some talks also that VS 2010 is not recommended for use when developing for Dynamics Solomon.
I believe also that there is SDK for Dynamics Solomon that you can use inside you application to connect to Solomon database and use data objects. We didn't try this yet but we found some references talking about developing code using this SDK.
http://www.microsoftdynamicsforums.com/forums/forum_posts.asp?TID=191&title=solomon-Object-model-code
Below is a sample code that uses Solomon SDK:
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Dynamics.SL.ObjectModel;
using System.Threading;
using System.Runtime.InteropServices;
namespace LoginSL
{
class Program
{
[DllImport("kernel32")]
static extern void Sleep(uint dwMilliseconds);
public static Microsoft.Dynamics.SL.ObjectModel.SIVToolbar sivTB;
public static Microsoft.Dynamics.SL.ObjectModel.SIVApplication sivApp;
static void Main(string[] args)
{
sivTB = new SIVToolbar();
sivTB.Login("servername", "systemdb", "company", "username", "password");
sivApp = sivTB.StartApplication("9850000.exe");
sivApp.Visible = true;
string datafile = "C:\\0101000.DTA";
string ctrlfile = "C:\\0101000.ctl";
string outfile = "C:\\0101000.log";
//In C# "\\" is the predefined escape sequence for backslash.
sivApp.Controls["cdata"].Value = (datafile.ToUpper());
sivApp.Controls["cfiletype"].Value = "ASCII";
sivApp.Controls["cscreen"].Value = "0101000";
sivApp.Controls["ccontrol"].Value = (ctrlfile.ToUpper());
sivApp.Controls["coutput"].Value = (outfile.ToUpper());
sivApp.Controls["cBegProcessing"].Value = true;
Sleep(5000); //remove the comment marks at the beginning of this line for workaround
sivApp.Quit();
sivApp.Dispose();
//GC.Collect();
//GC.WaitForPendingFinalizers();
//GC.Collect();
Sleep(5000); //remove the comment marks at the beginning of this line for workaround
sivTB.Logout();
sivTB.Quit();
sivTB.Dispose();
//GC.Collect();
//GC.WaitForPendingFinalizers();
//GC.Collect();
//MessageBox.Show("TI is complete"); // Displays complete message
}
}
}

Related

Saxon .NET with C++ CLI

I had an idea to use C++ CLI to interact with the Saxon .NET interface . The problem is that every single example on Saxonica is with C# , and not C++ . can you give me an example that caches an XML file , and using Xslt filepaths to transform it using C++ CLI to use the .NET interface ???
Also pls dont give me workarounds that dont use C++ CLI
A minimal sample using Saxon .NET HE 10 (tested with 10.6 initially, now updated to 10.7) run on Windows against .NET framework 4.8 is e.g.
#include "pch.h"
using namespace System;
using namespace Saxon::Api;
int main(array<System::String ^> ^args)
{
Processor^ processor = gcnew Processor();
Console::WriteLine(processor->ProductVersion);
DocumentBuilder^ docBuilder = processor->NewDocumentBuilder();
Uri^ baseUri = gcnew Uri(System::Environment::CurrentDirectory + "\\");
XdmNode^ inputDoc = docBuilder->Build(gcnew Uri(baseUri, "input-sample1.xml"));
XsltCompiler^ xsltCompiler = processor->NewXsltCompiler();
xsltCompiler->BaseUri = baseUri;
XsltExecutable^ xsltExecutable = xsltCompiler->Compile(gcnew Uri(baseUri, "sheet1.xsl"));
Xslt30Transformer^ xslt30Transformer = xsltExecutable->Load30();
xslt30Transformer->ApplyTemplates(inputDoc, processor->NewSerializer(Console::Out));
return 0;
}
Example project at https://github.com/martin-honnen/SaxonHECLIExample1.
To write to a file instead, use e.g.
FileStream^ resultStream = File::OpenWrite("result1.xml");
xslt30Transformer->ApplyTemplates(inputDoc, processor->NewSerializer(resultStream));
resultStream->Close();
instead of xslt30Transformer->ApplyTemplates(inputDoc, processor->NewSerializer(Console::Out));; example adaption is at https://github.com/martin-honnen/SaxonHECLIExample1/tree/WriteToFileInsteadOfConsole

Why am I getting a Type Mismatch when assigning a Worksheet to a Worksheet var?

I am trying to incorporate Aspose Cells for .NET into this class that is using Excel Interop (rather than rewrite the whole thing to use Aspose Cells, which I am just now trying out, I want to at least start with a hybrid approach).
The problem is that I get a "Type mismatch" exception with this code:
private Workbook _xlBook;
. . .
Worksheet asposePT = _xlBook.Worksheets[_xlBook.Worksheets.Add()];
My project has a reference to Aspose.Cells, version 16.11.0.0 (Runtime version v4.0.30319)
I have these usings in the class file:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
using ReportRunner.SharedCode;
using Microsoft.Office.Interop.Excel;
using System.Runtime.InteropServices;
using System.Text;
using Excel = Microsoft.Office.Interop.Excel;
This is the exception detail:
System.Runtime.InteropServices.COMException was caught
HResult=-2147352571
Message=Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
Source=System.Dynamic
ErrorCode=-2147352571
StackTrace:
at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String
message)
at CallSite.Target(Closure , CallSite , ComObject , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at CallSite.Target(Closure , CallSite , Sheets , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at ReportRunner.ProduceUsage.ProduceUsageRpt.PopulatePivotTableSheetAsposeCells() in c:\Projects\ReportRunner -
Private Build\ReportRunner\ProduceUsage\ProduceUsageRpt.cs:line 1550
at ReportRunner.ProduceUsage.ProduceUsageRpt.GenerateProduceUsageRpt() in c:\Projects\ReportRunner - Private Build
\ReportRunner\ProduceUsage\ProduceUsageRpt.cs:line 167
InnerException:
ProduceUsageRpt.cs:line 1550 is:
Worksheet asposePT = _xlBook.Worksheets[_xlBook.Worksheets.Add()];
Do I need a "using Aspose" or something like that? Do I need to explicitly declare Worksheet as an Aspose Worksheet (as opposed to Excel Interop), or what?
UPDATE
Even when I changed the code from this:
Worksheet asposePT = _xlBook.Worksheets[_xlBook.Worksheets.Add()];
asposePT.Name = "AsposePivotTable";
Aspose.Cells.Pivot.PivotTableCollection pivotTables = asposePT.PivotTables();
...to this (not parens are removed at end of last line):
Aspose.Cells.Worksheet asposePT = _xlBook.Worksheets[_xlBook.Worksheets.Add()];
asposePT.Name = "AsposePivotTable";
Aspose.Cells.Pivot.PivotTableCollection pivotTables = asposePT.PivotTables;
...I still get the same exception.
Well, Aspose.Cells APIs (an independent .NET library) and MS Excel Interop (Office Automation) APIs are different in many ways, both have different architectures, so you cannot just parse objects regarding their API b/w them. I think you should use only Aspose.Cells APIs to instantiate a Workbook (spreadsheet), add/update or manipulate data into the worksheets, etc. and finally save the Excel file. I guess your underlying _xlBook object might be culprit which you might have instantiated with respect to MS Excel Interop. APIs.
I am working as Support developer/ Evangelist at Aspose.

Accessing Sqlite Database from Windows Forms Application in C++

I am new to C++ (was previously into Java) and I am trying to find my way around it for the past few days. I am having a Sqlite DB in my local Machine which I am trying to access in order to display the results of a query on a Windows Application Form using DataGridView.
I was able to locate a good place to start here but later discovered that this was more concentrated towards SQL server and not SQLite and the code failed when I tried to replace this part of code
String^ connectionString =
"Integrated Security=SSPI;Persist Security Info=False;" +
"Initial Catalog=Northwind;Data Source=localhost";
with this
String^ connectionString = "Data Source=C:\\data\\test.db"
to point to my local Sqlite DB (test.db).
Upon more digging I found that I was able to find C# examples for linking SQLite DB to Windows Form Application here. Next I tried to convert the C# code provided into a C++ one but failed.
I have been looking all around for simple C++ examples which would help me understand how to link a Sqlite DB to a Windows Form Application but am not able to do so yet.
I would appreciate it greatly if anyone could point me to one such example.
To access SQLite DB from managed code use System.Data.SQLite library. It's a managed library supported by SQLite Development Team and you can use it with managed C++ also. Here is the sample:
using namespace System::Data::SQLite;
using namespace System::Text;
void Test()
{
SQLiteConnection ^db = gcnew SQLiteConnection();
try
{
db->ConnectionString = "Data Source=C:\\data\\test.db";
db->Open();
// Do the job here
db->Close();
}
finally
{
delete (IDisposable^)db;
}
}

How do I make a stable connection with SQL Server 2008 and code my first CRUD operations in C++

How do I make a connection between my C++ project and SQL Server 2008 ? Refering to some articles on the Internet, the best way is to use ADO.NET API. I've searched some samples of code making the crud operations and showing how to make a DB connection, and here is the best tutorial that I've found.
The issue here, after making a new project New > Visual C++ > Empty Project (.NET Framework 4.5) some errors occured when I've copyied/pasted the first snippet, which is :
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
// Standard
#using <mscorlib.dll>
#using <System.dll>
#using <system.data.dll> // This is required for the ADO.NET Provider
#include <tchar.h>
using namespace System;
using namespace System::Data;
using namespace System::Data::SqlClient;
// This is the entry point for this application
int _tmain(void)
{
SqlConnection * mySQLConnection;
SqlCommand * mySQL;
SqlDataReader * myReader;
try
{
mySQLConnection = new SqlConnection(
S"server=local;Trusted_Connection=yes;database=pubs;");
mySQL = new SqlCommand (S"select * from authors",
mySQLConnection);
mySQLConnection->Open (); // Open up the connection
myReader = mySQL->ExecuteReader ();
while(myReader->Read ())
Console::WriteLine(myReader->get_Item("au_lname")->ToString ());
}
catch(Exception * e)
{
Console::Write(e->ToString () );
}
__finally
{
myReader->Close ();
mySQLConnection->Close();
}
return 0;
}
here is the first error of 22 :
2 IntelliSense: "#using" requires C++/CLI mode c:\Users\Nectarys\Documents\Visual Studio 2013\Projects\Project2\Project2\Source.cpp
How do I fix this, please ? (If the problem cames from the provider, how do I check if I have it installed and that I have the right version ?)
Note : I've included "stdafx.h" into my project. I haven't installed any provider after this copy/paste.
The error is because your project does not have the Common Language Runtime flag set, so it is trying to compile as native code instead of managed. To set the flag, right-click on the project and click on Properties, under the general section there is a "Common Language Runtime Support" option.
The tutorial you linked is from 2002 and uses manged C++, which was introduced before CLI/C++. To compile managed C++, the flag needs to be set to /clr:oldsyntax. Visual Studio intellisense will give you errors because it does not support managed C++, only CLI/C++. A migration guide is here: http://msdn.microsoft.com/en-us/library/ms235289.aspx, but essentially you need to replace the asterisks in your variable declarations with hats ("^"), use gcnew instead of new, do not put a "S" in front of strings (they're automatically managed strings in managed code), and change how you're accessing an item of the reader to use the array accesssor. The new code would be this (compile with /clr):
#using <mscorlib.dll>
#using <System.dll>
#using <system.data.dll> // This is required for the ADO.NET Provider
#include <tchar.h>
using namespace System;
using namespace System::Data;
using namespace System::Data::SqlClient;
// This is the entry point for this application
int _tmain(void)
{
SqlConnection ^ mySQLConnection;
SqlCommand ^ mySQL;
SqlDataReader ^ myReader;
try
{
mySQLConnection = gcnew SqlConnection(
"server=local;Trusted_Connection=yes;database=pubs;");
mySQL = gcnew SqlCommand ("select * from authors",
mySQLConnection);
mySQLConnection->Open (); // Open up the connection
myReader = mySQL->ExecuteReader ();
while(myReader->Read ())
Console::WriteLine(myReader["au_lname"]->ToString ());
}
catch(Exception ^ e)
{
Console::Write(e->ToString () );
}
__finally
{
myReader->Close ();
mySQLConnection->Close();
}
return 0;
}
Unfortunately I do not know of a guide on how to use the SqlClient written in CLI/C++.

Accessing Sharepoint Web Services

I'm beginning to convert my Access 2007 module to C# so I can deploy it to my SQL Server. Just in step 1, retrieving the lists on the SP server. I had something like it working using VS2005, but things seem to have changed in VS2010. Here's my code...
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Timesheets
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
CPAS_ListSVC.Lists listService = new CPAS_ListSVC.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
listService.Url = "http://moss.mava.xxxxxx.com/FACSEC/xxxfacilities/XXXCONSTRUCTION/CPAS/_vti_bin/lists.asmx"; // Site
System.Xml.XmlNode activeItemData = listService.GetListItems("","",null, null, "500", null, "");
tbXML.Text = activeItemData.ToString();
}
}
}
I'm getting an error when I instantiate the variable 'listService'. Compiler says ".lists" is not part of CPAS_ListSVC....
Indeed, Intellisense agrees (what a surprise....) Is there a different class I should be instantiating?
Found the answer:
I needed to use a Web Service instead of a standard service.