My code:
SqlDBAccess db = new SqlDBAccess();
ReportDocument report;
private void btnSave_Click(object sender, EventArgs e)
{
Wait wait = new Wait();
report = new ReportDocument();
string reportPath = Application.StartupPath + "\\Reports\\" + "TabulationSheet1to5.rpt";
report.Load(reportPath);
try
{
if (comClass.Text.ToString() == "<< Select Class >>".ToString() || comExam.Text.ToString() == "<<Select Turm>>")
{
MessageBox.Show("Please select class and exam...", "Required Field", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
else
{
wait.Show();
Cursor.Current = Cursors.WaitCursor;
db.Adapter("drop table tabulationSheet1");
db.Adapter("select * into tabulationSheet1 from tabulationSheet1To5 where Class = '"
+ comClass.Text.ToString() + "' and Exam = '" + comExam.Text.ToString() + "' and YearAt = '"+dateTimeYear.Text.ToString()+"'");
report.SetDataSource(db.Adapter("select SchoolName, Logo, Add1, Add2,"
+ " StudentName,RollNo,Bangla1Sub,Bangla1Obj, "
+ " Bangla2Sub, Bangla2Obj, English1Sub, English1Obj,English2Sub,"
+ " Math,IslamicStudiesSub,IslamicStudiesObj,HinduReligiousStudiesSub,"
+ " HinduReligiousStudiesObj,BuddhistReligiousStudiesSub,BuddhistReligiousStudiesObj,"
+ " ParibeshParichitiBigganSub,ParibeshParichitiBigganObj,ParibeshPaichitiShomajSub,"
+ " ParibeshPaichitiShomajObj,GeneralKnowledge,PhysicalEducationAndHealth,"
+ " Srutilipi,Drawing,Class,Exam,MonthAt,YearAt,Dated"
+ " from Activation, tabulationSheet1"));
crystalReportViewer1.ReportSource = report;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
wait.Dispose();
Cursor.Current = Cursors.Default;
}
finally
{
wait.Dispose();
Cursor.Current = Cursors.Default;
}
}
When I am executing my code Crystalreportviewer asking for user name and password. When Im puting user name and password Login Failed for server name. I want to avoid this server name, user name and password for show report. Can anybody help me how can I connect App.configFile in my Crystalreportviewer for showing report.