ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
how can i display crystal report in button_click? am 
working with VS2005..........plz help me
 Question Submitted By :: Raghu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how can i display crystal report in button_click? am working with VS2005..........plz help me
Answer
# 1
protected void Page_Load(object sender, EventArgs e)
    {
       
        _ControlId = Request["ControlId"];       
        
        CrystalDecisions.CrystalReports.Engine.Database 
crDatabase;
        CrystalDecisions.CrystalReports.Engine.Table 
crTable;

        TableLogOnInfo dbConn = new TableLogOnInfo();
        
        _oRpt = new ReportDocument();

        // loading the ItemReport in report document 
        _oRpt.Load(Server.MapPath("~\\reports") + "\\" 
+ "RepsAndWar.rpt");

        // getting the database, the table and the 
LogOnInfo object which holds login information 
        crDatabase = _oRpt.Database;

        // getting the table in an object array of one item 
        object[] arrTables = new object[1];
        crDatabase.Tables.CopyTo(arrTables, 0);

        // assigning the first item of array to crTable by 
downcasting the object to Table 
        crTable = 
(CrystalDecisions.CrystalReports.Engine.Table)arrTables[0];

        dbConn = crTable.LogOnInfo;

        // setting values 
        parseConnString(Settings.CnxBackShop);
        dbConn.ConnectionInfo.ServerName = _ServerName;
        dbConn.ConnectionInfo.DatabaseName = 
_DatabaseName;        
        dbConn.ConnectionInfo.UserID = _UserID;
        dbConn.ConnectionInfo.Password = _Password;



        // applying login info to the table object 
        crTable.ApplyLogOnInfo(dbConn);

        crTable.Location = 
dbConn.ConnectionInfo.DatabaseName + ".dbo." + 
crTable.Location.Substring(crTable.Location.LastIndexOf
(".") + 1);
        crTable.LogOnInfo.ConnectionInfo.ServerName = 
dbConn.ConnectionInfo.ServerName;
        

         // defining report source 
        CrystalReportViewer1.ReportSource = _oRpt;

        setReportParameters();
        

    }

 private void setReportParameters()
    {
        // all the parameter fields will be added to this 
collection 
        ParameterFields paramFields = new ParameterFields();

        // the parameter fields to be sent to the report 
        ParameterField pfControlId = new ParameterField();

        // setting the name of parameter fields with wich 
they will be recieved in report 
        pfControlId.ParameterFieldName = "@ControlId";

        // the above declared parameter fields accept 
values as discrete objects 
        // so declaring discrete objects 
        ParameterDiscreteValue dc_ControlId = new 
ParameterDiscreteValue();

        // setting the values of discrete objects 
        dc_ControlId.Value = _ControlId;

        // now adding these discrete values to parameters 
        pfControlId.CurrentValues.Add(dc_ControlId);

        // now adding all these parameter fields to the 
parameter collection 
        paramFields.Add(pfControlId);

        // finally add the parameter collection to the 
crystal report viewer 
        CrystalReportViewer1.ParameterFieldInfo = 
paramFields;
    }

 protected void btnExport_Click(object sender, EventArgs e)
    {
        MemoryStream oStream;
        oStream = (MemoryStream)_oRpt.ExportToStream
(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat)
;
        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/pdf";
        Response.BinaryWrite(oStream.ToArray());
        Response.End();

    }
 
Is This Answer Correct ?    0 Yes 0 No
V
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
Can you prevent a class from overriding?  3
What is the difference between System.String and System.StringBuilder classes?  6
How to authenticate web service? When you enter the web service url in browser it should ask username and password. After entering the un&pwd we have to show its methods and service description(wsdl).  2
What is indexers in C# Bodhtree1
What is manifest ? Digital-GlobalSoft1
What is Dispose method in .NET?  1
What?s the .NET datatype that allows the retrieval of data by a unique key?  2
Difference between direct type casting and using "as" keyword? TCS1
Are private class-level variables inherited?  3
About Virtual functions and their use ? MMTS8
Did it possible to cast a generic type of derived class to generic type of base class? TCS1
what is read only and constant IBM8
In c# how to connect crystal report?  2
What debugging tools come with the .NET SDK? CorDBG  1
If all code is written in a try block and write a catch block with Exception type Exception .In that scenario will all the exceptions catched by that catch block? or any exceptions which will not be caught? Honeywell3
What is a pre-requisite for connection pooling?  1
What?s the top .NET class that everything is derived from?  4
How you will handle session when deploying application in more than a server? Describe session handling in a webform, how does it work and what are the limits? Microsoft3
How To Maintain Transaction In C#? Phoenix-Technologies1
What are the collection classes ? Digital-GlobalSoft1
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com