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



The information in this article applies to:

  • Microsoft SQL Server 2000 Analysis Services
  • Microsoft Visual Studio .NET (2002), Professional Edition

This article was previously published under Q297728
BUG #: 11289 (Plato7.x)

SYMPTOMS

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

RESOLUTION

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 the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

STATUS

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.

MORE INFORMATION

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.


Modification Type:MajorLast Reviewed:6/30/2004
Keywords:kbBug kbfix kbssas800sp1fix KB297728