Tuesday, March 6, 2012

AdomdConnection Exception ........

Hi

I had created a dataminig model using "Asociattion Rules " , as the model is now working i want to get the rules out of it , so I try the following query in SQL 2005 Managanment Studio and its working fine

SELECT NODE_RULE FROM [Credit Card Table].CONTENT

Now I have to do this through code so used following code from book "DataMining using SQL Server 2005" , but the code gives error in making connection and says

"Either VMWINXP/Adminsittrator dont have right on the database SmartRulesApps or database not exsists" , now i use same credentials to run query in SQL 2005 Managmnet Studio and its working ! can you guys give me some hint whats i done wrong . One more point I check the database secuirty folder for my database SmartRulesApps and it contains dbo but how can i add VMWINXP/Adminsittrator(which is already my system admin ) to this security users ? i tried but its not working. Please let me know any thing you find that can help , you can also send me email at razi_rais@.yahoo.com

private void OpenConnection()
{
AdomdConnection con = new AdomdConnection("location=localhost;Initial Catalog=SmartRulesEngine;Integrated Security=SSPI");
// AdomdConnection("location=VMWINXP;Effective UserName=VMWINXP\\Administrator;Initial Catalog=SmartRulesEngine;");

try
{
con.Open();

AdomdCommand cmd = new AdomdCommand();

cmd.CommandText = "SELECT NODE_RULE FROM [Credit Card Table].CONTENT";
cmd.Connection = con;
AdomdDataReader reader;

reader = cmd.ExecuteReader();
System.Collections.ArrayList lst = new System.Collections.ArrayList();
int i = 0;
while (reader.Read())
{
lst.Add(reader.GetValue(i++).ToString());
}
reader.Close();
}
catch (System.Exception exp)
{

}
finally
{
con.Close();
}
}

This looks really strange, given that your error message mentions the SmartRulesApps catalog, while your code seems to use the SmartRulesEngine catalog.

What is the actual catalog name?

No comments:

Post a Comment