Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating 'connection string' in CRM SDK 4 programmatically
    primarykey
    data
    text
    <p>I'm writing application, which connects to CRM using CRM SDK 4. In the first version, I've been using app.config file (section 'connectionStrings')</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="mycrm" connectionString="Authentication Type=Integrated; Server=http://ServerName/OrganizationName;"/&gt; &lt;/connectionStrings&gt; </code></pre> <p>and (in code):</p> <pre><code>DataContext ctx = new DataContext("mycrm"); </code></pre> <p>and it works fine. But now, application should let user to choose authentification type, type server name, user id, password, etc. I've created connection string, but I don't know how to use it. DataContext and CrmConnection objects, AFAIK, has only constructors with connectionString name (from app.config file) as parameter. When I try to use my connectionString I get exception:</p> <pre><code> System.ApplicationException was unhandled </code></pre> <p>Message="Unable to load the connection string name 'Authentication Type=Integrated; Server=<a href="http://ServerName/OrganizationName" rel="nofollow noreferrer">http://ServerName/OrganizationName</a>;'" Source="Microsoft.Xrm.Client" StackTrace: at Microsoft.Xrm.Client.CrmConnection.GetConnectionStringFrom(String connectionStringName) at Microsoft.Xrm.Client.CrmConnection..ctor(String connectionStringName, String connectionString) at Microsoft.Xrm.Client.CrmConnection..ctor(String connectionStringName) at ARP.EstateExtensions.PaymentsUploader.MainWindows..ctor(String connectionString) in C:\Users\mrobaszynski\Desktop\PU\PaymentsUploader\MainWindows.xaml.cs:line 38 at ARP.EstateExtensions.PaymentsUploader.LoginWindow.bOK_Click(Object sender, RoutedEventArgs e) in C:\Users\mrobaszynski\Desktop\PU\PaymentsUploader\LoginWindow.xaml.cs:line 92 at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.Controls.Button.OnClick() at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent) at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.TranslateAndDispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunInternal(Window window) at PaymentsUploader.App.Main() in C:\Users\mrobaszynski\Desktop\PU\PaymentsUploader\obj\Release\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.NullReferenceException Message="Object reference not set to an instance of an object." Source="Microsoft.Xrm.Client" StackTrace: at Microsoft.Xrm.Client.CrmConnection.GetConnectionStringFrom(String connectionStringName) InnerException:</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload