FIX: Unhandled Exception Error Querying with the Data Mining Provider from ADO+ and C#

This article was previously published under Q297728
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 11289 (Plato7.x)
When you execute a query with the Data Mining provider using ActiveX Data Objects (ADO+) from a Microsoft C# application, the application fails with an error message that resembles the following:
An unhandled exception of type 'System.Security.SecurityException' occurred in C:\WINNT\Microsoft.NET\Framework\v1.0.2204\System.Data.DLL
To resolve this problem, obtain the latest service pack for the Microsoft SQL Server 2000 (the Analysis Services Components - Sql2kasp1.exe). For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
Microsoft has confirmed that this is a problem in SQL Server 2000 Analysis Services version 8.0. This problem was first corrected in the Analysis Services Components of Microsoft SQL Server 2000 Service Pack 1.

Steps to Reproduce Behavior

  1. Create a new C# console application.
  2. Add the following code to the application:
    using System;using System.Data;using System.Data.OleDb;namespace DataMine{   class Class1   {      [STAThread]      static void Main(string[] args)      {         try         {            // Create a connection and a command object              OleDbConnection cn = new OleDbConnection();            OleDbCommand cmd = new OleDbCommand();            // Set the Connection String            cn.ConnectionString="Provider=MSOLAP;location=localhost;" +                "Mining Persistence Format=1;" +                "Mining Location=c:/program files/microsoft analysis services" +                "/data/foodmart 2000/member card RDBMS";            cn.Open();            // Set the command text            cmd.CommandText="Create Mining Model cucu  " +                "( TheKey long key, Age double continuous," +                "HairColor text discrete PREDICT, Gender text discrete, " +                "CarColor text discrete) using microsoft_decision_trees ";            cmd.CommandType = CommandType.Text;            cmd.Connection=cn;            // Execute the command            cmd.ExecuteNonQuery();            Console.WriteLine("Mining Model Creation Completed");            Console.ReadLine();         }      catch(System.Exception e)         {            Console.WriteLine(e.Message.ToString());            Console.ReadLine();         }      }   }}					
(c) Microsoft Corporation 2001, All Rights Reserved. Contributions by John Desch, Microsoft Corporation.


Article ID: 297728 - Last Review: 02/27/2014 21:08:26 - Revision: 3.3

  • Microsoft SQL Server 2000 Analysis Services
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • kbnosurvey kbarchive kbbug kbfix kbssas800sp1fix KB297728