Kindly assist me. I have and dataset and a report. The report loads well, but when i try to move to page two or click on an item in the group tree(postback), i am prompted to enter the login credetials. I am not sure of what is supposed to be placed in the
CrystalReportViewer1_Init event to correct this. i will be glad if someone points me to the right direction. Below is my code:
jkoross
0 Points
5 Posts
Crystal report viewer not navigating to page two,dataset login prompt
Apr 26, 2012 03:06 PM|LINK
Friends,
Kindly assist me. I have and dataset and a report. The report loads well, but when i try to move to page two or click on an item in the group tree(postback), i am prompted to enter the login credetials. I am not sure of what is supposed to be placed in the CrystalReportViewer1_Init event to correct this. i will be glad if someone points me to the right direction. Below is my code:
conn =new OracleConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString);
cmd =new OracleCommand("", conn);
da =new OracleDataAdapter();
da.SelectCommand = cmd;
ds =new DataSet();
rptDoc =new ReportDocument();
cmd.CommandType =CommandType.StoredProcedure;
CrystalReportViewer1.EnableDatabaseLogonPrompt =false;
if (!IsPostBack)
{
DsReports dsreport = new DsReports(); // .xsd file name
DataTable dt = new DataTable();
//set the name of data table
dt.TableName ="ViewBasics";
dt = getData();
dsreport.Tables[0].Merge(dt);
rptDoc.Load(Server.MapPath("~/Reports/basics.rpt"));
rptDoc.SetDataSource(dsreport);
CrystalReportViewer1.ReportSource = rptDoc;
}
}
public DataTable getData()
{
try
{
conn.Open();
cmd.Parameters.Clear();
cmd.CommandText ="GET_BASICS";
cmd.Parameters.Add(new OracleParameter("pcursor", OracleDbType.RefCursor)).Direction = ParameterDirection.Output;
da.Fill(ds);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
if (conn.State != ConnectionState.Closed)
conn.Close();
}
return ds.Tables[0];
}
protected void CrystalReportViewer1_Init(object sender, EventArgs e)
{
}