Quantcast

Microsoft CRM Customization: Integration with third party SQL Application/Database

Get the WebProNews Newsletter:


[ Business]

Microsoft CRM – Client Relationship Management package from Microsoft Business Solutions was initially designed to be customizable with Microsoft Visual Studio.Net and one of its programming languages – C#.Net or VB.Net.

You can use ADO.Net, Web Service, Transact SQL scripting and stored procedures, deploy such SQL Server tools as Linked Server to all ODBC/OLEDB compliant database, including ORACLE, Sybase, Ingress, DB2, Unidata, Pervasive SQL, Ctree and even Lotus Notes/Domino. In this small article we would like to give you the clue on programming the integration with SQL third party Database.

First – use Microsoft CRM SDK to initiate communication with Microsoft CRM, we have it in C#:

&nbsp&nbsp&nbsp&nbsp String[] arr1 = coll.AllKeys;
&nbsp&nbsp&nbsp&nbsp int loop1, loop2;
&nbsp&nbsp&nbsp&nbsp for (loop1 = 0; loop1 < (arr1.Length>0?1:arr1.Length); loop1++)
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp String[] arr2 = coll.GetValues(arr1[loop1]);
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp for (loop2 = 0; loop2 < arr2.Length; loop2++)
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp strAccountId = arr2[loop2].Replace("}",null);
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp strAccountId = strAccountId.Replace("{",null);
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp }
&nbsp&nbsp&nbsp&nbsp }

&nbsp&nbsp&nbsp&nbsp if (Page.IsPostBack==false)
&nbsp&nbsp&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp // Server should be set with the name of the platform Web server
&nbsp&nbsp&nbsp&nbsp string Server = ConfigurationSettings.AppSettings["ServerName"];

&nbsp&nbsp&nbsp&nbsp // VirtualDirectory should be set with the name of the Microsoft
&nbsp&nbsp&nbsp&nbsp // CRM Virtual Directory on the platform Web server
&nbsp&nbsp&nbsp&nbsp string VirtualDirectory = "mscrmservices";
&nbsp&nbsp&nbsp&nbsp string strDir = "http://" + Server + "/" + VirtualDirectory + "/";

&nbsp&nbsp&nbsp&nbsp // BizUser proxy object
&nbsp&nbsp&nbsp&nbsp Microsoft.CRM.Proxy.BizUser oBizUser = new Microsoft.CRM.Proxy.BizUser ();
&nbsp&nbsp&nbsp&nbsp oBizUser.Credentials = System.Net.CredentialCache.DefaultCredentials;
&nbsp&nbsp&nbsp&nbsp oBizUser.Url = strDir + "BizUser.srf";

&nbsp&nbsp&nbsp&nbsp // CRMAccount proxy object
&nbsp&nbsp&nbsp&nbsp Microsoft.CRM.Proxy.CRMAccount account = new Microsoft.CRM.Proxy.CRMAccount ();
&nbsp&nbsp&nbsp&nbsp account.Credentials = System.Net.CredentialCache.DefaultCredentials;
&nbsp&nbsp&nbsp&nbsp account.Url = strDir + "CRMAccount.srf";

Then you use ADO.Net for calling stored procedure with parameters to do the integration job:

&nbsp&nbsp&nbsp&nbsptry
&nbsp&nbsp&nbsp&nbsp {
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp string SQLStatement="ICS_UpdateAccountPrivate '"+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp strAccountId +"' , '" + this.TextBoxWorkPerformed.Text +
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp "' , "+doubleEncode(System.Double.Parse(this.TextBoxAnnualRevenue.Text))+" , "+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp intEncode(System.Int32.Parse(this.TextBoxNumberOfEmployees.Text.Replace(",","")))+" , "+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp doubleEncode(System.Double.Parse(this.TextBoxAverageGrowthRate.Text))+" , "+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp "'"+this.DropDownListOwnership.SelectedItem.Text +"' , "+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp intEncode(System.Int32.Parse(this.RadioButtonList.SelectedItem.Value))+" , "+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp intEncode(System.Int32.Parse(this.TextBoxCredit.Text.Replace(",","")))+" , '"+
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp this.TextBoxComments.Text+"'";

&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp System.Data.SqlClient.SqlConnection tmpConnection =
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp new System.Data.SqlClient.SqlConnection(ConfigurationSettings.AppSettings["ConnectionStringICS"]
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp );

Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, California, Texas, New York, Georgia and Florida and having locations in multiple states and internationally (www.albaspectrum.com), he is Dexterity, SQL, C#.Net, Crystal Reports and Microsoft CRM SDK developer.

Microsoft CRM Customization: Integration with third party SQL Application/Database
Comments Off
About Andrew Karasev
Andrew Karasev is Chief Technology Officer in Alba Spectrum Technologies USA nationwide Microsoft CRM, Microsoft Great Plains customization company, based in Chicago, California, Texas, New York, Georgia and Florida and having locations in multiple states and internationally (www.albaspectrum.com), he is Dexterity, SQL, C#.Net, Crystal Reports and Microsoft CRM SDK developer. WebProNews Writer
Top Rated White Papers and Resources

Comments are closed.

  • Join for Access to Our Exclusive Web Tools
  • Sidebar Top
  • Sidebar Middle
  • Sign Up For The Free Newsletter
  • Sidebar Bottom