none
Oledb Connection RRS feed

  • Question

  • I want to connect to the SQL Server 2008 using OLE DB data provider.

    Can any body suggest how can I get the correct connection string for a databases named 'test'

    I'm using the Windows Authentication to the SQL Server.


    My blog : http://thuruinhttp.wordpress.com
    Thursday, January 6, 2011 1:27 PM

Answers

  • You can find examples at the below link:

    http://www.connectionstrings.com/sql-server-2008#p2

    Any reason why you are using OLEDB instead of the native .NET library?


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, January 6, 2011 1:40 PM
  • I think, you can try with following things..

    add name space

     

    using System.Data.OleDb;
    Connection string using Windows Authentication

     

    string sqlQ = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=test;Data Source=your db server name ";

    Connection string using SQL SERVER Authentication

    string sqlQ = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa; password = your pass ; Initial Catalog=test;Data Source=your db server name ";

    OleDbConnection con = new
    
    OleDbConnection(sqlQ);
    con.Open();// Open your connection
    //Perform your operation con.Close(); // Close your connection

     


    Hasibul Haque, Bsc in CSE
    Friday, January 7, 2011 9:50 AM

All replies

  • You can find examples at the below link:

    http://www.connectionstrings.com/sql-server-2008#p2

    Any reason why you are using OLEDB instead of the native .NET library?


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, January 6, 2011 1:40 PM
  • I think, you can try with following things..

    add name space

     

    using System.Data.OleDb;
    Connection string using Windows Authentication

     

    string sqlQ = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=test;Data Source=your db server name ";

    Connection string using SQL SERVER Authentication

    string sqlQ = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa; password = your pass ; Initial Catalog=test;Data Source=your db server name ";

    OleDbConnection con = new
    
    OleDbConnection(sqlQ);
    con.Open();// Open your connection
    //Perform your operation con.Close(); // Close your connection

     


    Hasibul Haque, Bsc in CSE
    Friday, January 7, 2011 9:50 AM
  • Hello Puboo,

    How was your issue? Did it be solved? 

    Because your thread has lasted for a long time, I will close it for you by marking an answer. If you have anything you need or you would like to re-open it , you can unmark or you can post another thread .

    Thank you for you understanding and support!

     

    Happy everyday! 


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 17, 2011 7:44 AM
    Moderator