แต่พอเอาโค๊ดเค้ามาลอง Run ดูก็ขึ้น Error ด้านล่างนี้ นั่งหาวิธีแก้มาอาทิตย์กว่าแล้ว
ขอรบกวนด้วยครับ ขอบคุณครับ
Quote:
Server Error in '/xxxx' Application.
Either the user, NT AUTHORITY\NETWORK SERVICE, does not have access to the TEST database, or the database does not exist.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.AnalysisServices.AdomdClient.AdomdErrorResponseException: Either the user, NT AUTHORITY\NETWORK SERVICE, does not have access to the TEST database, or the database does not exist.
โค๊ดใน Script
Code (C#)
public void Page_Load(object sender, EventArgs e)
{
string cnstr1= "Provider=MSOLAP;"
+"Persist Security Info=false;"
+"Data Source=local;"
+"Initial Catalog=TEST;";
System.Text.StringBuilder result = new System.Text.StringBuilder();
AdomdConnection conn = new AdomdConnection(cnstr1);
{
conn.Open();
AdomdCommand cmd = conn.CreateCommand();
cmd.CommandText = @"SELECT {[a].} on columns,{[c].[d]} on rows from [subtest]";
CellSet cs = cmd.ExecuteCellSet();
result.Append("\t\t\t");
TupleCollection tuplesOnColumns = cs.Axes[0].Set.Tuples;
foreach (Microsoft.AnalysisServices.AdomdClient.Tuple column in tuplesOnColumns)
{
result.Append(column.Members[0].Caption + "\t");
}
result.AppendLine();
TupleCollection tuplesOnRows = cs.Axes[1].Set.Tuples;
for (int row = 0; row < tuplesOnRows.Count; row++)
{
for (int members = 0; members < tuplesOnRows[row].Members.Count; members++ )
{
result.Append(tuplesOnRows[row].Members[members].Caption + "\t");
}
for (int col = 0; col < tuplesOnColumns.Count; col++)
{
result.Append(cs.Cells[col, row].FormattedValue + "\t");
}
result.AppendLine();
}
conn.Close();
lblText.Text = result.ToString();
}
}
The remote server returned an error: (405) Method Not Allowed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.