Paul.Cairns

PI OLEDB Connection String issue

Discussion created by Paul.Cairns on Sep 10, 2013
Latest reply on Sep 10, 2013 by 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:

 

 

 

 

 

 

 

 



Outcomes