9 Replies Latest reply on Sep 10, 2013 3:25 PM by Paul.Cairns

    PI OLEDB Connection String issue

    Paul.Cairns

      I am trying to create a connection to the PI db via a Windows form application in VS 2012 using the following code:

       

       

       
      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Windows.Forms;
      using System.Data.OleDb;
      
      
      namespace PI_DBCon
      {
          public partial class Form1 : Form
          {
              OleDbConnection connPI = new OleDbConnection("Provider=PIOLEDB;Data Source=Server Name01;Initial Catalog=piarchive;Integrated Security=SSPI;");
                            
      
              public Form1()
              {
                  InitializeComponent();
              }
      
              private void button1_Click(object sender, EventArgs e)
              {
                  
                  connPI.Open();
                  connPI.Close();
              }
          }
      }
      

       

       

      When I try to run the connection the form loads but when I click the button I get the following error: