0
我有晶體report.i發送你我的.aspx頁面和代碼隱藏page.Thing是,我發送它的工作良好在vs2005相同的代碼,windowsxp.But剛纔我們進入了window7,現在我正在創建另一個它不是開玩笑的。 請給我建議。 的.aspx代碼: -你所要求的報告需要更多的信息與水晶report2008,vs2008
<%@ Page Language="C#" AutoEventWireup="true" Culture="en-AU" CodeFile="report1.aspx.cs" Inherits="report1" %>
<%@ Register Assembly="CrystalDecisions.Web,Version=10.5.3700.0,Culture=neutral,PublicKeyToken=692fbea5521e1304"
Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Jumbo Bags Report Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1"
runat="server"
AutoDataBind="True"
Height="1116px"
ReportSourceID="CrystalReportSource1"
Width="887px" DisplayGroupTree="False" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="CR_rpt1.rpt">
</Report>
</CR:CrystalReportSource>
</div></form>
</body></html>
代碼隱藏頁: -
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using JumboBagsApp.Library;
public partial class report1 : System.Web.UI.Page
{
private void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo)
{
TableLogOnInfos mytableloginfos = new TableLogOnInfos();
mytableloginfos = CrystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
{
myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
}
}
protected void Page_Load(object sender, EventArgs e)
ConnectionInfo myConnectionInfo = new ConnectionInfo();
myConnectionInfo.ServerName = "xxxxxxxx";
myConnectionInfo.DatabaseName = "xxxxx";
myConnectionInfo.UserID = "xxx";
myConnectionInfo.Password = "xxxxxxx";
myConnectionInfo.Type = ConnectionInfoType.SQL;
myConnectionInfo.IntegratedSecurity = false;
setDBLOGONforREPORT(myConnectionInfo);
ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
string scompany = "";
string sempcode = "";
string ssr_no = "";
string sappln_no = "";
if (Request.QueryString["comcode"] != null && Request.QueryString["comcode"].ToString() != "")
{
scompany = Request.QueryString["comcode"].ToString();
}
if (Request.QueryString["empcode"] != null && Request.QueryString["empcode"].ToString() != "")
{
sempcode = Request.QueryString["empcode"].ToString();
}
//DateTime dtSysdate4 = DateTime.Parse(txtfrom_date2.Text, CultureInfo.CreateSpecificCulture("en-AU"), DateTimeStyles.AssumeLocal);
//string txtdate4 = dtSysdate3.ToString("yyyy/MM/dd");
//string strcur_date4 = txtdate4;
if (Request.QueryString["cur_date"] != null && Request.QueryString["cur_date"].ToString() != "")
{
sappln_no = Request.QueryString["cur_date"].ToString();
}
Library lib = new Library();
//library lib = new library();
DataTable dtdetailed = new DataTable();
//dtdetailed = lib.GetDetaileddbySrno(sappln_no.Trim());
if (sappln_no != "")
{
paramField = new ParameterField();
paramField.Name = "@cur_date";
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = sappln_no.Trim();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.RefreshReport;
}
else
{
Response.Write("SrNo Not Found");
return;
}
}
}
請給我建議。 謝謝。