本文整理汇总了C#中ParameterValues.Add方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterValues.Add方法的具体用法?C# ParameterValues.Add怎么用?C# ParameterValues.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterValues
的用法示例。
在下文中一共展示了ParameterValues.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: printReport
public Boolean printReport(CrystalDecisions.CrystalReports.Engine.ReportClass crReport, CrystalReportViewer CrystalReportViewer1, String param1, String ParamName1, String param2, String ParamName2)
{
if (PrinterName=="none") return false;
paramField.ParameterFieldName = ParamName1;
discreteVal.Value = param1;
paramField.CurrentValues.Add (discreteVal);
paramFields.Add (paramField);
crReport.DataDefinition.ParameterFields[0].CurrentValues.Add (discreteVal);
paramField2.ParameterFieldName = ParamName2;
discreteVal2.Value = param2;
paramField2.CurrentValues.Add (discreteVal2);
paramFields.Add (paramField2);
crReport.DataDefinition.ParameterFields[1].CurrentValues.Add (discreteVal2);
CrystalReportViewer1.ReportSource = crReport;
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.RefreshReport();
ParameterValues tmpParam = new ParameterValues();
ParameterValues tmpParam2 = new ParameterValues();
tmpParam.Add(discreteVal);
tmpParam2.Add(discreteVal2);
crReport.DataDefinition.ParameterFields[0].ApplyCurrentValues(tmpParam);
crReport.DataDefinition.ParameterFields[1].ApplyCurrentValues(tmpParam2);
crReport.PrintOptions.PrinterName = PrinterName;
// crReport.PrintToPrinter(1,false,1,1);
crReport.PrintToPrinter(1,false,1,99);
//Response.write (PrinterName);
return true;
}
示例2: btnExecute_Click
private void btnExecute_Click(object sender, EventArgs e)
{
ReportDocument report = new ReportDocument();
report.Load(this.filePath);
report.SetDatabaseLogon(userName, password, server, db);
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
//order no
crParameterDiscreteValue.Value = txtFilter.Text;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["orderNo"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//start date
crParameterDiscreteValue.Value = dtpStartDate.Value;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["startDate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//end date
crParameterDiscreteValue.Value = dtpEndDate.Value;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["endDate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = server;
crConnectionInfo.DatabaseName = db;
crConnectionInfo.UserID = userName;
crConnectionInfo.Password = password;
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo = crConnectionInfo;
TableLogOnInfos logOnInfos = new TableLogOnInfos();
logOnInfos.Add(logOnInfo);
crystalReportViewer.LogOnInfo = logOnInfos;
crystalReportViewer.ReportSource = report;
crystalReportViewer.Refresh();
}
示例3: GroupReport_Load
private void GroupReport_Load(object sender, EventArgs e)
{
repDoc = new ReportDocument();
ParameterFields rptParams;
ParameterValues paramValues;
ParameterDiscreteValue paramDiscreteValue;
ParameterField paramField;
try
{
repDoc.Load("../../Reports/Group.rpt");
//repDoc.Load("C:\\Users\\keith.sullivan\\Documents\\CIS\\CISApp\\CISApp\\Reports\\Group.rpt");
rptParams = repDoc.ParameterFields;
paramValues = new ParameterValues();
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = groupId;
paramValues.Add(paramDiscreteValue);
paramField = rptParams["studentgroup"];
paramField.CurrentValues = paramValues;
crystalReportViewer1.ReportSource = repDoc;
crystalReportViewer1.Refresh();
}
catch (Exception ex)
{
Console.WriteLine(ex);
Console.WriteLine("Could not connect to report");
}
}
示例4: button1_Click
private void button1_Click(object sender, EventArgs e)
{
var report = new rptTestimonial();
ParameterValues pvValues = new ParameterValues();
ParameterDiscreteValue pdvDiscreteValue = new ParameterDiscreteValue();
pdvDiscreteValue.Value = textBox1.Text;
pvValues.Add(pdvDiscreteValue);
ParameterFieldDefinitions pfdDefinitions = report.DataDefinition.ParameterFields;
ParameterFieldDefinition prdDefinition = pfdDefinitions["textThing"];
prdDefinition.ApplyCurrentValues(pvValues);
/*var data =
Database.Row("learner_details a, enrollments b, enrollmentscourses c, courses d",
"a.Division = '" + clsGlobal.loggedOnUserDivison + "' AND a.LearnerNumber = '" +
number.Selection +
"' AND b.LearnerKey = a.LearnerKey AND c.idEnrollments = b.idEnrollments AND" +
" d.idCourses = c.idCourses");*/
report.DataDefinition.FormulaFields["mainText"].Text = "\"" + textBox1.Text + "\"";
report.DataDefinition.FormulaFields["principle"].Text = "\"" + GlobalProperties.DivisionPrinciple + "\"";
report.DataDefinition.FormulaFields["name"].Text = "\"" + learner["Surname"] + ", " + learner["name"]+ "\"";
report.DataDefinition.FormulaFields["learnerNumber"].Text = "\"" + number + "\"";
//report.DataDefinition.FormulaFields["respParty"].Text = "\"" + clsGlobal.loggedOnUser + "\"";
//report.DataDefinition.FormulaFields["course"].Text = "\"" + Convert.ToString(data["Name1"]) + "\"";
//logs.WriteXml(@"C:\tmpXml.xml");
var frmReport = new frmReport(report) { Text = "Testimonial" };
frmReport.ShowDialog();
}
示例5: FrmVisualizadorContrato_Load
private void FrmVisualizadorContrato_Load(object sender, EventArgs e)
{
//ReportDocument report = new ReportDocument();
//report.Load("C:\\Users\\João\\Documents\\Video Aulas\\Canal Professor Drausion\\1° Temporada\\KISNER_EVENTOS\\Apresentacao\\Relatorios\\Contrato\\RelContrato.rpt");
//string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
//report.Load("\\Relatorios\\Contrato\\RelContrato.rpt");
Relatorios.Contrato.RelContrato report = new Relatorios.Contrato.RelContrato();
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = codEvento;
crParameterFieldDefinitions = report.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["ParCodEvento"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
//trabalhando com os brinquedos escolhidos pelo usuário! Usando DataSet
/*Relatorios.Contrato.DsEventoBrinquedo eb = new Relatorios.Contrato.DsEventoBrinquedo();
DataTable brinquedos = eb.Tables.Add("DtBrinquedo");
brinquedos.Columns.Add("codBrinquedo", Type.GetType("System.Int32"));
brinquedos.Columns.Add("nome", Type.GetType("System.String"));
BrinquedoColecao bc = new BrinquedoColecao();
*/
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = report;
crystalReportViewer1.Refresh();
}
示例6: button1_Click
private void button1_Click(object sender, EventArgs e)
{
try
{
ReportDocument crystalrpt = new ReportDocument();
crystalrpt.Load(@"C:\Users\Lahkrome\Desktop\Beta Sinergia\alfa2_Sinergia\CrystalReport.rpt");
//crystalReportViewer1.ReportSource = crystalrpt;
//crystalReportViewer1.Refresh();
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = textBox1.Text;
crParameterFieldDefinitions = crystalrpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["ProductName"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crystalReportViewer1.ReportSource = crystalrpt;
crystalReportViewer1.Refresh();
}
catch (Exception ex)
{
MessageBox.Show("Error"+ex);
}
}
示例7: SetCurrentValuesForParameterField
private void SetCurrentValuesForParameterField(ParameterFields parameterFields, ArrayList arrayList)
{
ParameterValues currentParameterValues = new ParameterValues();
foreach (object submittedValue in arrayList)
{
ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
parameterDiscreteValue.Value = submittedValue.ToString();
currentParameterValues.Add(parameterDiscreteValue);
}
ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME];
parameterField.CurrentValues = currentParameterValues;
}
示例8: Read
public void Read(string srr)
{
this.reportQuary = dateTimePicker1.Text + " to " + dateTimePicker2.Text;
string query = "";
query = "Select * From TbDailyIncome Where IncomeDate BETWEEN '" + dateTimePicker1.Value.Date + "' AND '" + dateTimePicker2.Value.Date + "' AND Debit = @Debit Order By IncomeDate";
if (query != "")
{
SqlConnection conn = new SqlConnection(this.connectionString);
SqlCommand comm = new SqlCommand(query, conn);
comm.Parameters.Add("@Debit", SqlDbType.VarChar, 50);
comm.Parameters["@Debit"].Value = comboBox1.Text;
SqlDataAdapter adap = new SqlDataAdapter();
DataSets.DebitVoucherDataSet dataset = new DataSets.DebitVoucherDataSet();
DebitVoucherByDebitACCrystalReport crp = new DebitVoucherByDebitACCrystalReport();
try
{
conn.Open();
adap.SelectCommand = comm;
adap.Fill(dataset, "DataTable1");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}
crp.SetDataSource(dataset);
ParameterValues v = new ParameterValues();
ParameterDiscreteValue dv = new ParameterDiscreteValue();
dv = new ParameterDiscreteValue();
dv.Value = this.reportQuary;
v.Add(dv);
crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);
crystalReportViewer2.ReportSource = crp;
}
}
示例9: load_pass
private void load_pass(CrystalReportPass crystal, string val)
{
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = val;
crParameterFieldDefinitions = crystal.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["idresep"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
示例10: load_pass
private void load_pass(transaksiugd crystal, string val)
{
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = val;
crParameterFieldDefinitions = crystal.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["pasien"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!SessionBox.CheckUserSession())
{
Response.Redirect("~/Admin/Login.aspx");
}
else
{
//load crystal report
ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("Sales_Return.rpt "));
//this.CrystalReportSource1.Report.FileName = Server.MapPath("Sales_order.rpt");
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo.ConnectionInfo.ServerName = "USER-3924AC2E56";
logOnInfo.ConnectionInfo.DatabaseName = "MyData";
logOnInfo.ConnectionInfo.UserID = "sa";
logOnInfo.ConnectionInfo.Password = "Goldjoint123";
//对报表中的每个表进行循环
for (int i = 0; i < Report.Database.Tables.Count; i++)
{
Report.Database.Tables[i].ApplyLogOnInfo(logOnInfo);
}
//load param
//CrystalDecisions.Web.Parameter param = new CrystalDecisions.Web.Parameter();
//param.Name = "OrderID";
//param.DefaultValue = Request.QueryString["TextBoxId"].ToString().Trim();
//add param
//this.CrystalReportSource1.Report.Parameters.Add(param);
ParameterValues ParamValues = new ParameterValues();
ParameterDiscreteValue ParamValue = new ParameterDiscreteValue();
ParamValue.Value = Request.QueryString["TextBoxId"].ToString().Trim();
ParamValues.Add(ParamValue);
Report.DataDefinition.ParameterFields[0].ApplyCurrentValues(ParamValues);
//bind
this.CrystalReportViewer1.ReportSource = Report;
//this.CrystalReportViewer1.ReportSourceID = this.CrystalReportSource1.ID;
//關閉左邊
this.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
//強制安裝ActiveX
CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
this.CrystalReportViewer1.DataBind();
}
}
示例12: AddParameter
public void AddParameter(string i_paramName, string i_paramValue, ParameterFields o_paramFields)
{
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
ParameterValues paramValues = new ParameterValues();
// Set the name of the parameter to modify.
paramField.ParameterFieldName = i_paramName;
// Set a value to the parameter.
paramDiscreteValue.Value = i_paramValue;
paramValues.Add(paramDiscreteValue);
paramField.CurrentValues = paramValues;
// Add the parameter to the ParameterFields collection.
o_paramFields.Add(paramField);
// Return paramFields
}
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
this.reportQuary = dateTimePicker1.Text + " to " + dateTimePicker2.Text;
string query = "";
query = "Select * From tblBankStatement Where TransDate BETWEEN '" + dateTimePicker1.Value.Date + "' AND '" + dateTimePicker2.Value.Date + "' Order By AutoId";
if (query != "")
{
SqlConnection conn = new SqlConnection(this.connectionString);
SqlCommand comm = new SqlCommand(query, conn);
SqlDataAdapter adap = new SqlDataAdapter();
DataSets.BankDataSet dataset = new DataSets.BankDataSet();
BankStatementCrystalReport crp = new BankStatementCrystalReport();
try
{
conn.Open();
adap.SelectCommand = comm;
adap.Fill(dataset, "DataTable1");
crp.SetDataSource(dataset);
ParameterValues v = new ParameterValues();
ParameterDiscreteValue dv = new ParameterDiscreteValue();
dv = new ParameterDiscreteValue();
dv.Value = this.reportQuary;
v.Add(dv);
crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);
crystalReportViewer2.ReportSource = crp;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}
}
}
示例14: AddParameter
private ParameterFields AddParameter(string paramName, string paramValue, ParameterFields paramFields)
{
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new
ParameterDiscreteValue();
ParameterValues paramValues = new ParameterValues();
// 设置要修改的参数的名称。
paramField.ParameterFieldName = paramName;
// 为该参数设置一个值。
paramDiscreteValue.Value = paramValue;
paramValues.Add(paramDiscreteValue);
paramField.CurrentValues = paramValues;
// 将该参数添加到 ParameterFields 集合中。
paramFields.Add(paramField);
return paramFields;
}
示例15: Read
public void Read()
{
this.reportQuary = fromdateTimePicker.Text + " to " + todateTimePicker2.Text;
string query = "";
query = "Select * From TbAccountStatement Where CreateDate BETWEEN '" + fromdateTimePicker.Value.Date + "' AND '" + todateTimePicker2.Value.Date + "' Order By AutoId";
if (query != "")
{
SqlConnection conn = new SqlConnection(this.connectionString);
SqlCommand comm = new SqlCommand(query, conn);
SqlDataAdapter adap = new SqlDataAdapter();
AccountStatementDataSet dataset = new AccountStatementDataSet();
AccountStatementCrystalReport crp = new AccountStatementCrystalReport();
try
{
conn.Open();
adap.SelectCommand = comm;
adap.Fill(dataset, "DataTable1");
crp.SetDataSource(dataset);
ParameterValues v = new ParameterValues();
ParameterDiscreteValue dv = new ParameterDiscreteValue();
dv = new ParameterDiscreteValue();
dv.Value = this.reportQuary;
v.Add(dv);
crp.DataDefinition.ParameterFields["report_query"].ApplyCurrentValues(v);
crystalReportViewer1.ReportSource = crp;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
conn.Close();
}
}
}