Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0 C# C#4.0
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;
            }
        }

My App.Config is:
<?xml version="1.0" encoding="utf-8" ?>
 
<configuration>
  <configSections>
  </configSections>
  <appSettings>
    <!--   User application and configured property settings go here.-->
    <!--   Example: <add key="settingName" value="settingValue"/> -->
    <add key="SqlConnectionString" value="Data Source=PLATFORM-FED393\SQLEXPRESS;Initial Catalog=PlatFormDB1;user=abeer;password=database;Integrated Security=True"/>
 
  </appSettings>
  
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="PickupDirectoryFromIis">
        <network defaultCredentials="true" host="localhost" port="587"/>
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

My Problem:
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.
Posted 5-Jul-12 23:53pm
Edited 6-Jul-12 0:32am
(no name)114.7K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 215
1 Suvendu Shekhar Giri 215
2 Andy Lanng 210
3 PIEBALDconsult 190
4 Abhinav S 184
0 Sergey Alexandrovich Kryukov 6,360
1 OriginalGriff 5,878
2 Peter Leow 2,514
3 Maciej Los 2,263
4 Abhinav S 2,249


Advertise | Privacy | Mobile
Web03 | 2.8.150414.1 | Last Updated 6 Jul 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100