none
got error when i try to connect to sql-server 2008

    Question

  • hi

    i have this connection to sql-server 2008:

    Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=INV_TERMINALS;Data Source=TJSQL


    and this is my connection code:

    public bool Open_PRI_Connection()         {             LOAD_PRI_Server();             Conn_PRI = new SqlConnection(SQL_PRI_Connection);              try             {                 Conn_PRI.Open();                 return true;             }            catch {

    return false;

    }         }

    but i get this error:  Keyword not supported: 'provider'

    i work on C#, WinForm, FW3.5 , sql-server  2008

    thanks

    Monday, November 19, 2012 6:02 AM

Answers

  • Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=INV_TERMINALS;Data Source=TJSQL

    Hello,

    That's a connection string for OleDbConnection, not for SqlConnection. Please remove "provider" / use this one instead:

    Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=INV_TERMINALS;Data Source=TJSQL


    Olaf Helper

    Blog Xing

    Monday, November 19, 2012 6:16 AM

All replies

  • Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=INV_TERMINALS;Data Source=TJSQL

    Hello,

    That's a connection string for OleDbConnection, not for SqlConnection. Please remove "provider" / use this one instead:

    Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=INV_TERMINALS;Data Source=TJSQL


    Olaf Helper

    Blog Xing

    Monday, November 19, 2012 6:16 AM
  • thanks for the help,

    I try this:

    Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=INV_TERMINALS;Data Source=TJSQL

    but still same error:  Keyword not supported: 'provider'

    Monday, November 19, 2012 8:06 AM
  • So you failed to recompile your code, did not change in all places or some other similar silly oversight that we all do from time to time.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Monday, November 19, 2012 8:46 AM