Connecting with the ADO.NET Data Provider
You can use the ADO.NET data provider to access the Connect Service from your Visual Studio project or your .NET or .NET Framework applications.
Connecting from an ADO.NET application
As a starting point, you can use the following example as a template for connecting to the Connect Service.
To connect using the Common Programming Model:
-
Add one of the two driver files depending on the application that you are using.
-
If you are using .NET Framework, add the driver file
NetSuite.SuiteAnalyticsConnect.dll
to the Global Assembly Cache (GAC) or directly to your project. -
If you are using .NET, add the driver file
NetSuite.SuiteAnalyticsConnectStd.dll
to your project.Note:The driver has dependencies to some packages. Ensure that the following NuGet packages are included: System.Configuration.ConfigurationManager, System.Diagnostics.PerformanceCouter, and System.Security.Permissions.
For information about how to add the driver files, see Downloading and Installing the ADO.NET Driver.
-
-
You can use code like the following example to use ADO.NET connectivity in your application. Replace the bold values with the values in Review the ADO.NET Data Server Configuration.
using System; using System.Data; using NetSuite.SuiteAnalyticsConnect; namespace AdoExample { class AdoExample { public static void Main(string[] args) { string connectionString = "Host=<ServiceHost>;"+ "Port=1708;"+ "ServerDataSource=NetSuite.com;"+ "User Id=test@netsuite.com;"+ "Password=<password>;"+ "CustomProperties='AccountID=<accountID>;RoleID=<roleID>';EncryptionMethod=SSL;"; using (OpenAccessConnection connection = new OpenAccessConnection(connectionString)) { Connection.Open(); Console.WriteLine("Connection successful"); } } } }
Note:The <ServiceHost>, <accountID>, and <roleID> variables correspond to your host name, account ID and role ID. The values are available on the SuiteAnalytics Connect Driver Download page under Your Configuration. You can access the SuiteAnalytics Connect Driver Download page using the Set Up Analytics Connect link in the Settings portlet when you are logged in to NetSuite. For more information, see Finding Your Settings Portlet.
If you are using Connect with TBA, ensure that you enter your token between quotation marks, for example, \"TOKEN"\.
In addition, you can check out sample code examples in the SuiteAnalytics Connect ADO.NET data provider installation folder. The default installation folder for 64-bit Windows should be in the following location: C:\Program Files (x86)\NetSuite\NetSuite ADO.NET Drivers.
For more information, see Downloading and Installing the ADO.NET Driver.
When you are updating an existing project, you must remove the reference to the old driver library and add a reference to the current version of the driver library.