reload of loaded state of cellsetgrid -
04-03-2006
, 03:47 AM
i've a problem with reloading the cellsetgrid when i restore view from
database.
when i load it for the first time it works, but when i reload the page
csg display me message :
There is a problem with this cube.
Column 'SET_CAPTION' does not belong to table rowsetTable.
what is wrong can anybody tell me
here is a code of this page:
namespace CellSample
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Xml.Serialization;
using System.Xml;
using System.IO;
/// <summary>
/// Summary description for csgControl.
/// </summary>
public class csgControl : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.Button btnSave;
protected System.Web.UI.WebControls.LinkButton lnkSave;
protected System.Web.UI.WebControls.CheckBox cbxAvailable;
protected System.Web.UI.WebControls.Label lblisAvailable;
protected System.Web.UI.WebControls.RequiredFieldValidator
rfvReportDescription;
protected System.Web.UI.WebControls.TextBox tbxReportDescription;
protected System.Web.UI.WebControls.Label lblReportDescription;
protected System.Web.UI.WebControls.RequiredFieldValidator
rfvReportName;
protected System.Web.UI.WebControls.TextBox tbxReportName;
protected System.Web.UI.WebControls.Label lblReportName;
protected System.Web.UI.WebControls.TextBox tbxDataBase;
protected System.Web.UI.WebControls.Label lblDataBase;
protected System.Web.UI.WebControls.TextBox tbxCubeName;
protected System.Web.UI.WebControls.Label lblCubeName;
protected System.Web.UI.WebControls.Panel pnlSaveReport;
protected System.Web.UI.WebControls.LinkButton lnkBack;
protected System.Web.UI.WebControls.LinkButton lnkBackToCubes;
protected RichTk.CellSetGrid csgMain;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
HideSaveControl();
int reportID = -1;
if(Session["Olap_SelectedReport"] != null)
{
reportID = int.Parse(Session["Olap_SelectedReport"].ToString());
}
if(reportID >= 1)
{
RestoreReport(reportID);
}
else if (reportID==0)
{
NewReport(Session["Olap_SelectedCube"].ToString());
}
//if(csgMain.CellSetQuery == null)
//{
// Response.Write("cell set is null");
//}
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
this.lnkBack.Click += new System.EventHandler(this.lnkBack_Click);
this.lnkSave.Click += new System.EventHandler(this.lnkSave_Click);
this.lnkBackToCubes.Click += new
System.EventHandler(this.lnkBackToCubes_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
#region events
private void btnSave_Click(object sender, System.EventArgs e)
{
Session["Olap_ReportQuery"] =
RichTk.Utilities.Serializer(csgMain.CellSetQuery);
ShowSaveControl();
}
private void lnkSave_Click(object sender, System.EventArgs e)
{
enovatio.CubeManager.CubeDAU cubeDAU = new
enovatio.CubeManager.CubeDAU();
enovatio.CubeManager.CubeDAS cubeDAS = new
enovatio.CubeManager.CubeDAS();
int cubeID = cubeDAS.GetCubeID(csgMain.Cube);
string reportDescription = this.tbxReportDescription.Text;
string reportName = this.tbxReportName.Text;
string database = this.tbxDataBase.Text;
string reportState = Session["Olap_ReportQuery"].ToString();
/*
StreamWriter sw = new StreamWriter(Server.MapPath("~//rep.txt"));
sw.Write(Session["Olap_ReportQuery"].ToString());
sw.Close();
*/
bool isAvailable = this.cbxAvailable.Checked;
cubeDAU.InsertNewReport(cubeID,reportDescription,r eportName,reportState,isAvailable);
HideSaveControl();
}
private void lnkBack_Click(object sender, System.EventArgs e)
{
HideSaveControl();
}
#endregion events
#region private methods
private void ShowSaveControl()
{
tbxCubeName.Text = csgMain.Cube;
tbxDataBase.Text = csgMain.CellSetQuery.oCon.Database;
this.tbxReportDescription.Text = "";
this.tbxReportName.Text = "";
pnlSaveReport.Visible = true;
csgMain.Visible = false;
btnSave.Visible = false;
}
private void HideSaveControl()
{
pnlSaveReport.Visible = false;
csgMain.Visible = true;
btnSave.Visible = true;
}
private void RestoreReport(int reportID)
{
string conStr = "";
string cubeName = "";
string dbName = "";
string reportDescription = "";
string reportName = "";
string reportState = "";
enovatio.CubeManager.CubeDAS cubeDAS = new
enovatio.CubeManager.CubeDAS();
cubeDAS.GetReportByID(reportID,ref reportDescription,ref
reportName,ref cubeName,ref reportState,ref dbName);
csgMain.Cube = cubeName;
conStr = "Data Source=local;Provider=MSOLAP;Initial Catalog=" +
dbName +
"; Execution Location=3;";
csgMain.ConnectionString = conStr;
csgMain.Xml = reportState;
/*
StreamWriter sw = new
StreamWriter(Server.MapPath("~//repLoad.txt"));
sw.Write(csgMain.Xml.ToString());
sw.Close();
*/
this.btnSave.Visible = false;
}
private void NewReport(string cubeName)
{
string conStr = "";
enovatio.CubeManager.CubeDAS cubeDAS = new
enovatio.CubeManager.CubeDAS();
string dbName = cubeDAS.GetCubeDbName(cubeName);
csgMain.Cube = cubeName;
conStr = "Data Source=local;Provider=MSOLAP;Initial Catalog=" +
dbName +
"; Execution Location=3;";
csgMain.ConnectionString = conStr;
}
#endregion private methods
private void lnkBackToCubes_Click(object sender, System.EventArgs e)
{
Response.Redirect("cubeMgr.aspx");
}
}//end class
} |