using System;
using gregn6Lib;
using System.Data;
using System.Data.OleDb;
using System.Windows.Forms;
namespace BLL
{
///
/// GridppReport µÄժҪ˵Ã÷¡£
///
public class Utility
{
//public const string GetDatabaseConnectionString() = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\..\..\Data\Northwind.mdb";
//´Ëº¯ÊýÓÃÀ´×¢²áGrid++Report£¬Äã±ØÐëÔÚÄãµÄÓ¦ÓóÌÐòÆô¶¯Ê±µ÷Óô˺¯Êý
//ÓÃÄã×Ô¼ºµÄÐòÁкŴúÌæ"AAAAAAA"£¬"AAAAAAA"ÊÇÒ»¸öÎÞЧµÄÐòÁкÅ
public static void RegisterGridppReport()
{
GridppReport TempGridppReport = new GridppReport();
bool Succeeded = TempGridppReport.Register("AAAAAAA");
if ( !Succeeded )
System.Windows.Forms.MessageBox.Show("Register Grid++Report Failed, Grid++Report will run in trial mode.", "Register"
,System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
}
private struct MatchFieldPairType
{
public IGRField grField;
public int MatchColumnIndex;
}
// ½« DataReader µÄÊý¾Ýת´¢µ½ Grid++Report µÄÊý¾Ý¼¯ÖÐ
public static void FillRecordToReport(IGridppReport Report, IDataReader dr)
{
MatchFieldPairType[] MatchFieldPairs = new MatchFieldPairType[Math.Min(Report.DetailGrid.Recordset.Fields.Count, dr.FieldCount)];
//¸ù¾Ý×Ö¶ÎÃû³ÆÓëÁÐÃû³Æ½øÐÐÆ¥Å䣬½¨Á¢DataReader×Ö¶ÎÓëGrid++Report¼Ç¼¼¯µÄ×Ö¶ÎÖ®¼äµÄ¶ÔÓ¦¹ØÏµ
int MatchFieldCount = 0;
for (int i=0; i