Connecting with the ADO.NET Data Provider

You can use the ADO.NET data provider to access the Connect Service from your Visual Studio environment or your ADO.NET application.

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:

  1. Include the NetSuite.SuiteAnalyticsConnect.dll file directly in your project.

  2. 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 e.g. \"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.

Note:

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.

Related Topics

Accessing the Connect Service Using an ADO.NET Data Provider
Prerequisites
Review the ADO.NET Data Server Configuration
Downloading and Installing the ADO.NET Driver
ADO.NET Connection Options
Authentication Using Server Certificates for ADO.NET
Removing the ADO.NET Driver

General Notices