Click here to Skip to main content
15,897,273 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: SQL Query works intermittently... [modified] Pin
TenmanS1427-Jun-07 9:20
TenmanS1427-Jun-07 9:20 
Questionurgent need about stored procedure..., Pin
Member 387988127-Jun-07 3:21
Member 387988127-Jun-07 3:21 
AnswerRe: urgent need about stored procedure..., Pin
Colin Angus Mackay27-Jun-07 3:37
Colin Angus Mackay27-Jun-07 3:37 
AnswerRe: urgent need about stored procedure..., Pin
dekart_roo27-Jun-07 6:46
dekart_roo27-Jun-07 6:46 
QuestionPrinting Pin
Blue_Boy27-Jun-07 3:10
Blue_Boy27-Jun-07 3:10 
AnswerRe: Printing Pin
Vasudevan Deepak Kumar27-Jun-07 3:13
Vasudevan Deepak Kumar27-Jun-07 3:13 
GeneralRe: Printing Pin
Blue_Boy27-Jun-07 5:27
Blue_Boy27-Jun-07 5:27 
QuestionExport Crystal reports Pin
itzmevishu27-Jun-07 2:51
itzmevishu27-Jun-07 2:51 
hi this is my procedure to export my .rpt to pdf, xls, doc or rtf. it's working good but when it comes to last line crReportDocument.Export(); ...plz once go through this code and kindly please help me out ......


In page load
-----------------------------

protected void btnGenRep_Click(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection("_constr");
con.Open();
SqlCommand cmd = new SqlCommand("GetLocations", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds, "tbLocations");

cmd.ExecuteNonQuery();
con.Close();

ReportDocument myReportDocument;
myReportDocument = new ReportDocument();
myReportDocument.Load(Server.MapPath("CrystalReport.rpt"));

myReportDocument.SetDataSource(ds);
CrystalReportViewer1.ReportSource = myReportDocument;
string rptFormat = ddlformat.SelectedItem.Value.ToString();
string format = GetReportFormat(rptFormat);
string repname = "CrystalReport." + format;
pal pall = new pal();
string ExportFile=pall.LoadReport(Request.PhysicalApplicationPath, rptFormat, myReportDocument, repname);


Response.Write("window.open(Exported/'" + ExportFile + "');");
}
catch (Exception ex)
{
Response.Write(ex.Message);

}
finally { }
}


public string GetReportFormat(string type)
{
switch (type)
{
case "DOC":
return "DOC";
case "XLS":
return "XLS";
case "RTF":
return "RTF";
case "PDF":
default:
return "PDF";
}
}










In class file


public string LoadReport(string path, string exportfile, ReportDocument crReportDocument, string filename)
{
ExportOptions crExportOptions ;
DiskFileDestinationOptions crDiskFileDestinationOptions;
string ExportPath;
ExportPath = path + "Exported\\";

if (Directory.Exists(ExportPath) == false)
{
Directory.CreateDirectory(path + "Exported\\");
}



crDiskFileDestinationOptions = new DiskFileDestinationOptions();

crExportOptions = new ExportOptions();

crExportOptions = crReportDocument.ExportOptions;

if (exportfile == "RTF")
{
crDiskFileDestinationOptions.DiskFileName = ExportPath + filename;
crExportOptions.ExportDestinationType=ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType=ExportFormatType.RichText;

}
if (exportfile == "PDF")
{
crDiskFileDestinationOptions.DiskFileName = ExportPath + filename;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

}
if (exportfile == "XLS")
{
crDiskFileDestinationOptions.DiskFileName = ExportPath + filename;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.Excel;


}

if (exportfile == "DOC")
{
crDiskFileDestinationOptions.DiskFileName = ExportPath + filename;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.WordForWindows;

}
try
{
crReportDocument.Export();->>> Error is occurred here
return filename;

}
catch (Exception ex)
{
throw (ex);
}
finally { }






}
AnswerRe: Export Crystal reports Pin
Vasudevan Deepak Kumar27-Jun-07 3:08
Vasudevan Deepak Kumar27-Jun-07 3:08 
GeneralRe: Export Crystal reports Pin
itzmevishu27-Jun-07 3:13
itzmevishu27-Jun-07 3:13 
GeneralRe: Export Crystal reports Pin
Vasudevan Deepak Kumar27-Jun-07 3:35
Vasudevan Deepak Kumar27-Jun-07 3:35 
GeneralRe: Export Crystal reports Pin
itzmevishu27-Jun-07 4:11
itzmevishu27-Jun-07 4:11 
GeneralRe: Export Crystal reports Pin
itzmevishu27-Jun-07 4:16
itzmevishu27-Jun-07 4:16 
QuestionMaintaining dynamic controls Pin
Venkatesh Mookkan27-Jun-07 2:15
Venkatesh Mookkan27-Jun-07 2:15 
AnswerRe: Maintaining dynamic controls Pin
Vasudevan Deepak Kumar27-Jun-07 3:12
Vasudevan Deepak Kumar27-Jun-07 3:12 
GeneralRe: Maintaining dynamic controls Pin
Venkatesh Mookkan27-Jun-07 6:05
Venkatesh Mookkan27-Jun-07 6:05 
QuestionCalling Applet using Javascript in Firefox Browser. Pin
Irshad Ahmed27-Jun-07 1:45
Irshad Ahmed27-Jun-07 1:45 
AnswerRe: Calling Applet using Javascript in Firefox Browser. Pin
Vasudevan Deepak Kumar27-Jun-07 1:51
Vasudevan Deepak Kumar27-Jun-07 1:51 
GeneralRe: Calling Applet using Javascript in Firefox Browser. Pin
Irshad Ahmed27-Jun-07 2:03
Irshad Ahmed27-Jun-07 2:03 
GeneralRe: Calling Applet using Javascript in Firefox Browser. Pin
Vasudevan Deepak Kumar27-Jun-07 3:11
Vasudevan Deepak Kumar27-Jun-07 3:11 
QuestionAsynchronous call in web service. Pin
sengottuvelud27-Jun-07 1:42
sengottuvelud27-Jun-07 1:42 
AnswerRe: Asynchronous call in web service. Pin
Vasudevan Deepak Kumar27-Jun-07 1:46
Vasudevan Deepak Kumar27-Jun-07 1:46 
GeneralRe: Asynchronous call in web service. Pin
sengottuvelud27-Jun-07 1:48
sengottuvelud27-Jun-07 1:48 
QuestionDisable cache Pin
fthavha27-Jun-07 1:32
fthavha27-Jun-07 1:32 
AnswerRe: Disable cache Pin
Vasudevan Deepak Kumar27-Jun-07 1:43
Vasudevan Deepak Kumar27-Jun-07 1:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.