less than 1 minute to read

In order to use SQProxy from a .NET application you must use the SQProxyWrapper, SFQWrapper, and interop libraries we have provided. To do so, add references to these libraries to a .NET project: right-click References in the Solution Explorer, choose Add Reference, select the Browse page, and choose the following three files, all located in C:\Program Files\Common Files\Microsoft Shared\VFP:

  • SQProxyWrapper.dll
  • SFQWrapper.dll
  • Interop.sqproxy.dll

Be sure to change the properties for Interop.sqproxy.dll: Embed Interop Types should be false and Copy Local true.

You can then use the wrappers with code like the example below:

csharp
using SFQWrapper; using SQProxyWrapper; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { SQProxy sqProxy = new SQProxy(); sqProxy.LoadProject(@"C:\Program Files\Stonefield Query SDK\Sample Project"); // Wait for project to finish loading while (!sqProxy.ProjectLoaded) { } System.Console.WriteLine("Project Loaded"); // Get references to some objects we'll need. SFQApplication application = sqProxy.SQApplication; ReportEngine reportEngine = application.ReportEngine; // Find out how many folders there are. System.Console.WriteLine("There are " + reportEngine.GetFolders().Count.ToString() + " folders"); // Display the folder names. foreach(Folder folder in reportEngine.GetFolders()) { System.Console.WriteLine(folder.FolderName); } // Run a report. bool result = reportEngine.RunReportToFile("Customers", "C:\\customers.pdf"); if (result) { System.Console.WriteLine("The Customers report was output to PDF."); } else { System.Console.WriteLine("The Customers report was not run successfully."); System.Console.WriteLine(reportEngine.ErrorMessage); } System.Console.ReadLine(); } } }

© Stonefield Software Inc., 2024 • Updated: 09/18/18
Comment or report problem with topic