locked
How to make connection in C# and SQL database? RRS feed

  • Question

  • I am facing some problem in C# and SQL database connection. Kindly suggest me how to do.

    Thursday, June 12, 2014 11:06 AM

All replies

  • Hi,

    Are you trying to create a connection to SQL Server from C# code inside CRM (like Plugins)?


    Admin QuikView Solution for CRM 2013

    Thursday, June 12, 2014 11:10 AM
  • Following is quick pseudo code related to this, see if this helps..

    DataSet CustomersDataSet = new DataSet();
    string databaseConnectionString= "Server=server;Database=northwind;UID=login;PWD=password;"
    SqlConnection connection = new SqlConnection(databaseConnectionString);
    connection.Open();
    
    SqlDataAdapter da = new SqlDataAdapter("select top 1 * from filteredaccount", connection);
    
    da.Fill(CustomersDataSet, "Customers");
    
    //Close the database connection.
    cn.Close();


    MayankP
    My Blog
    Follow Me on Twitter

    Thursday, June 12, 2014 12:00 PM
    Answerer
  • Thanks you..

    Monday, December 8, 2014 5:00 AM