{
if (eRowHandle >= 0)
{
SaleDataImportModel data = (SaleDataImportModel)gridView1GetRow(eRowHandle);
switch (dataProductMappingStatus)
{
case 0:
eAppearanceBackColor = ColorLightGreen;
break;
case 1:
eAppearanceBackColor = ColorLightYellow;
break;
case 2:
eAppearanceBackColor = ColorLightPink;
break;
}
}
}
你用错误事件了
XtraReport report = new XtraReport();// 建立报表实例reportDpi = 254F;
reportDataSource = dt;//设置报表数据源
reportReportUnit = DevExpressXtraReportsUIReportUnitTenthsOfAMillimeter;
//reportPageHeight = 1169;
//reportPageWidth = 827;
if (radioGroup2EditValueToString() == "A4")
reportPaperKind = SystemDrawingPrintingPaperKindA4;
if (radioGroup2EditValueToString() == "A5")
reportPaperKind = SystemDrawingPrintingPaperKindA5;
reportMargins = new SystemDrawingPrintingMargins(107, 99, 99, 107);
//报表头
ReportHeaderBand reportHeader = new ReportHeaderBand();
reportHeaderDpi = 254F;
//数据
DetailBand detail = new DetailBand();
detailDpi = 254F;
//页眉
PageHeaderBand pageHeader = new PageHeaderBand();
pageHeaderDpi = 254F;
//页脚
PageFooterBand pageFooter = new PageFooterBand();
pageFooterDpi = 254F;
//分组头
GroupHeaderBand groupHeader = new GroupHeaderBand();
groupHeaderDpi = 254F;
groupHeaderGroupFieldsAddRange(new DevExpressXtraReportsUIGroupField[] { new DevExpressXtraReportsUIGroupField("箱号", DevExpressXtraReportsUIXRColumnSortOrderAscending)});
//分组尾
GroupFooterBand groupFooter = new GroupFooterBand();
groupFooterDpi = 254F;
//报表尾
ReportFooterBand reportFooter = new ReportFooterBand();
reportFooterDpi = 254F;
pageHeaderHeight = ConvertToInt32(spinEdit1Value); ;
detailHeight = ConvertToInt32(spinEdit2Value);
pageFooterHeight = 50;
groupHeaderHeight = 0;
groupFooterHeight = 50;
reportFooterHeight = 50;
reportBandsAddRange(new DevExpressXtraReportsUIBand[] { reportHeader, detail, pageHeader, reportFooter, pageFooter, groupHeader, groupFooter });
//封面 DevExpressXtraReportsUIXRLabel A1 = new DevExpressXtraReportsUIXRLabel();
A1Dpi = 254F;
A1Font = new SystemDrawingFont("宋体", 36F, SystemDrawingFontStyleBold);
A1Location = new SystemDrawingPoint(0, 212);
A1Name = "A1";
A1Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A1ParentStyleUsingUseFont = false;
A1Size = new SystemDrawingSize(reportPageWidth - (reportMarginsLeft + reportMarginsRight) - 2, 190);
A1Text = "浙江XXX服饰股份有限公司";
A1TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleCenter;
reportBands[BandKindReportHeader]ControlsAdd(A1);
DevExpressXtraReportsUIXRLabel A2 = new DevExpressXtraReportsUIXRLabel();
A2Dpi = 254F;
A2Font = new SystemDrawingFont("宋体", 36F, SystemDrawingFontStyleBold);
A2Location = new SystemDrawingPoint(0, 466);
A2Name = "A2";
A2Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A2ParentStyleUsingUseFont = false;
A2Size = new SystemDrawingSize(reportPageWidth - (reportMarginsLeft + reportMarginsRight) - 2, 148);
A2Text = "装 箱 单";
A2TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleCenter;
reportBands[BandKindReportHeader]ControlsAdd(A2);
DevExpressXtraReportsUIXRLabel A3 = new DevExpressXtraReportsUIXRLabel();
A3Dpi = 254F;
A3Font = new SystemDrawingFont("宋体", 28F, SystemDrawingFontStyleBold);
A3Location = new SystemDrawingPoint(0, 762);
A3Name = "A3";
A3Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A3ParentStyleUsingUseFont = false;
A3Size = new SystemDrawingSize(reportPageWidth - (reportMarginsLeft + reportMarginsRight) - 2, 127);
A3Text = "订单号:" + str_HTBN;
A3TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleLeft;
reportBands[BandKindReportHeader]ControlsAdd(A3);
DevExpressXtraReportsUIXRLabel A4 = new DevExpressXtraReportsUIXRLabel();
A4Dpi = 254F;
A4Font = new SystemDrawingFont("宋体", 28F, SystemDrawingFontStyleBold);
A4Location = new SystemDrawingPoint(0, 910);
A4Name = "A4";
A4Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A4ParentStyleUsingUseFont = false;
A4Size = new SystemDrawingSize(reportPageWidth - (reportMarginsLeft + reportMarginsRight) - 2, 127);
A4Text = "客户名:" + str_KHName;
A4TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleLeft;
reportBands[BandKindReportHeader]ControlsAdd(A4);
DevExpressXtraReportsUIXRLabel A5 = new DevExpressXtraReportsUIXRLabel();
A5Dpi = 254F;
A5Font = new SystemDrawingFont("宋体", 22F, SystemDrawingFontStyleBold);
A5Location = new SystemDrawingPoint(0, 1058);
A5Name = "A5";
A5Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A5ParentStyleUsingUseFont = false;
A5Size = new SystemDrawingSize(reportPageWidth - (reportMarginsLeft + reportMarginsRight) - 2, 127);
A5Text = "共 " + hejixiangshu + " 箱( 方案编号: " + str_Fenzu + " )";
A5TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleLeft;
reportBands[BandKindReportHeader]ControlsAdd(A5);
DevExpressXtraReportsUIXRLabel A6 = new DevExpressXtraReportsUIXRLabel();
A6Dpi = 254F;
A6Font = new SystemDrawingFont("宋体", 22F, SystemDrawingFontStyleBold);
A6Location = new SystemDrawingPoint(212, 1206);
A6Name = "A5";
A6Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A6ParentStyleUsingUseFont = false;
A6Size = new SystemDrawingSize(317, 106);
A6Text = "其中:";
A6TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleRight;
reportBands[BandKindReportHeader]ControlsAdd(A6);
DevExpressXtraReportsUIXRLabel A7 = new DevExpressXtraReportsUIXRLabel();
A7Dpi = 254F;
A7Font = new SystemDrawingFont("宋体", 22F, SystemDrawingFontStyleBold);
A7Location = new SystemDrawingPoint(0, 2286);
A7Name = "A5";
A7Padding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
A7ParentStyleUsingUseFont = false;
A7Size = new SystemDrawingSize(reportPageWidth - (reportMarginsLeft + reportMarginsRight) - 2, 148);
A7Text = DateTimeNowToString("yyyy 年 MM 月 dd 日");
A7TextAlignment = DevExpressXtraPrintingTextAlignmentMiddleCenter;
reportBands[BandKindReportHeader]ControlsAdd(A7);
DevExpressXtraReportsUIXRPageBreak A8 = new DevExpressXtraReportsUIXRPageBreak();
A8Dpi = 254F; A8Location = new SystemDrawingPoint(0, 2455);
reportBands[BandKindReportHeader]ControlsAdd(A8);
//封面合计
int lie = -1;
int a = 529;//X
int b = 1206;//Y
int c = 508;//size x
int d = 106;//size y
for (int i = 5; i < dtColumnsCount; i++)
{
if (dtColumns[i]Caption != "长袖衬衫规格" && dtColumns[i]Caption != "中袖衬衫规格" && dtColumns[i]Caption != "短袖衬衫规格")
{
lie++;
DevExpressXtraReportsUIXRLabel A = new DevExpressXtraReportsUIXRLabel();
ADpi = 254F;
AFont = new SystemDrawingFont("宋体", 22F, SystemDrawingFontStyleBold);
ALocation = new SystemDrawingPoint(a, b + lie d);
AName = "A" + i + "标";
APadding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
AParentStyleUsingUseFont = false;
ASize = new SystemDrawingSize(c, d);
AText = dtColumns[i]Caption + ":";
ATextAlignment = DevExpressXtraPrintingTextAlignmentMiddleRight;
reportBands[BandKindReportHeader]ControlsAdd(A);
DevExpressXtraReportsUIXRLabel B = new DevExpressXtraReportsUIXRLabel();
BDataBindingsAddRange(new DevExpressXtraReportsUIXRBinding[] { new DevExpressXtraReportsUIXRBinding("Text", dt, dtColumns[i]Caption, "") });
BDpi = 254F;
BFont = new SystemDrawingFont("宋体", 22F, SystemDrawingFontStyleBold);
BLocation = new SystemDrawingPoint(a + c, b + lie d);
BName = "A" + i;
BPadding = new DevExpressXtraPrintingPaddingInfo(5, 5, 0, 0, 254F);
BParentStyleUsingUseFont = false;
BSize = new SystemDrawingSize(c, d);
DevExpressXtraReportsUIXRSummary C = new DevExpressXtraReportsUIXRSummary();
CFormatString = "{0} 件";
CRunning = DevExpressXtraReportsUISummaryRunningReport;
BSummary = C;
BText = dtColumns[i]Caption;
BTextAlignment = DevExpressXtraPrintingTextAlignmentMiddleLeft;
reportBands[BandKindReportHeader]ControlsAdd(B);
}
}
int colCount = dtColumnsCount;
//int[] cw = { 100, 100, 180, 100, 400 };
string p = spinEdit3Value + "," + spinEdit4Value + "," + spinEdit5Value + ",100," + spinEdit6Value;
string[] cw = pSplit(',');
int cw8 = 172;
int cw5 = ConvertToInt32(cw[0]) + ConvertToInt32(cw[1]) + ConvertToInt32(cw[2]) + ConvertToInt32(cw[3]) + ConvertToInt32(cw[4]);
int colWidth = (reportPageWidth - (reportMarginsLeft + reportMarginsRight) - cw5) / (colCount - chenshancount - 5);
if (colWidth < cw8)
colWidth = (reportPageWidth - (reportMarginsLeft + reportMarginsRight) - cw5 - chenshancount cw8) / (colCount - 2 chenshancount - 5);
else
cw8 = colWidth;在默认情况下,GridView 不支持编辑合并后的单元格。本示例主要展示如何创建一个支持编辑合并单元格的自定义GridView。
Imports MicrosoftVisualBasic
Imports System
Imports SystemCollectionsGeneric
Imports SystemComponentModel
Imports SystemData
Imports SystemDrawing
Imports SystemLinq
Imports SystemText
Imports SystemWindowsForms
Namespace EditMergedCells
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
Dim dt As DataTable
dt = New DataTable()
dtColumnsAdd("Column1")
dtColumnsAdd("Column2")
Dim dr As DataRow = dtNewRow()
dr(0) = "Value1"
dr(1) = "Value2"
dtRowsAdd(dr)
dr = dtNewRow()
dr(0) = "Value1"
dr(1) = "Value3"
dtRowsAdd(dr)
dr = dtNewRow()
dr(0) = "Value1"
dr(1) = "Value5"
dtRowsAdd(dr)
dr = dtNewRow()
dr(0) = "Value4"
dr(1) = "Value5"
dtRowsAdd(dr)
dr = dtNewRow()
dr(0) = "Value4"
dr(1) = "Value5"
dtRowsAdd(dr)
dr = dtNewRow()
dr(0) = "Value4"
dr(1) = "Value5"
dtRowsAdd(dr)
myGridControl1DataSource = dt
gridControl1DataSource = dt
End Sub
End Class
End Namespace
using System;
using SystemCollectionsGeneric;
using SystemComponentModel;
using SystemData;
using SystemDrawing;
using SystemLinq;
using SystemText;
using SystemWindowsForms;
namespace EditMergedCells
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DataTable dt;
dt = new DataTable();
dtColumnsAdd("Column1");
dtColumnsAdd("Column2");
DataRow dr = dtNewRow();
dr[0] = "Value1";
dr[1] = "Value2";
dtRowsAdd(dr);
dr = dtNewRow();
dr[0] = "Value1";
dr[1] = "Value3";
dtRowsAdd(dr);
dr = dtNewRow();
dr[0] = "Value1";
dr[1] = "Value5";
dtRowsAdd(dr);
dr = dtNewRow();
dr[0] = "Value4";
dr[1] = "Value5";
dtRowsAdd(dr);
dr = dtNewRow();
dr[0] = "Value4";
dr[1] = "Value5";
dtRowsAdd(dr);
dr = dtNewRow();
dr[0] = "Value4";
dr[1] = "Value5";
dtRowsAdd(dr);
myGridControl1DataSource = dt;
gridControl1DataSource = dt;
}
}
}
数据库文件直接拷贝,如果不是频繁的读写长期占用,可以直接拷贝数据库目录源文件,另行保存一份即可。
数据库管理程序备份,比如phpmyadmin,有导出为sql的备份文件格式,或者其他管理工具,都可以连接到数据库然后导出备份。
如果在本机 *** 作,还可以使用脚本制定计划任务,定时执行脚本复制备份。
使用云备份系统,搭建云数据库云备份,全时间自动备份。
1、xtraReport有两种类型的参数Parameter和datasource。关于parameter与datasource的区别
11、如果您一个report之需要一份参数,那么可以直接使用Parameter,如果您想要传递一个List<object>那么只能使用数据源的方式传参
12、如果使用Parameter的方式,reportParameters[0]value = "xxx"就可以了,下面我们重点讨论使用数据源的方式
2、怎样使用数据源传递List<object>
xtraReports参数支持IList接口的类型的参数,但是官方给出了答复List<dynamic>类型暂时不支持,所以List<Type>中的Type必须是存在的类型,您如果可以定义所有reports的参数的Type,就可以通过动态修改Type的类型实现动态参数了。
xtraReport参数支持数据链接,以及数据链接的查询结果DataSet。但是官方给出了答复。在序列化的时候,你所定义的数据链接类或者是DataSet,不会一起持久化。所以给xtraReport定义DataSet类型的参数的话,需要您自己额外写代码来保存每个xtraReport的参数
而且DataSet的参数的访问方式为 TableNamePropertyName这种类型的参数是没有办法随xtraReports一起保存的。使用DataSet可以实现,但是数据源参数无法保存。
3、如何动态传递数据源类型参数给XtraReports
如果你是devexpress19版,那么dev直接支持json类型的参数,免谈
如果您是16版左右的,这里可以使用C#动态创建类来实现。List<Type>中的Type必须是存在的类型是么?那我就发现这个报表参数类型不存在就动态创建。
怎么创建?参考:DynamicClass
如果该xtraReport对应的参数再内存种不存在
Type @class = ClassFactoryInstanceCreate(properties);
TypeDic[type] = @class;缓存类型信息
直接使用List<dynamic> datasource作为数据源
List里面存放var instance = (dynamic)ActivatorCreateInstance(@class);
亲测可用
备份:mysqldump -u root -p123456 kcgl> c:\20090219sql
mysqldump 备份命令
root 用户名(root管理员)
123456 密码
kcgl 备份的数据库名;
> 备份符号
20090219sql 备份的文件名
还原:
mysql -u root -p123456 kcgl< c:\20090219sql
mysql 还原命令
root 用户名(root管理员)
123456 密码
dbcurr 备份的数据库名;
< 还原符号
20090219sql还原的文件名
注意:首先要确保你的mysql 中有kcgl这个库,还原命令是不会自动建库的。
mysqldump 远程备份
mysqldump -h ip -uroot -proot database > c:\datasql
---------其他---------
mysqldump备份:
mysqldump -u用户名 -p密码 -h主机 数据库 a -w "sql条件" --lock-all-tables > 路径
案例:
mysqldump -uroot -p1234 -hlocalhost db1 a -w "id in (select id from b)" --lock-all-tables > c:\aatxt
mysqldump还原:
mysqldump -u用户名 -p密码 -h主机 数据库 < 路径
案例:
mysql -uroot -p1234 db1 < c:\aatxt
mysqldump按条件导出:
mysqldump -u用户名 -p密码 -h主机 数据库 a --where "条件语句" --no-建表> 路径
mysqldump -uroot -p1234 dbname a --where "tag='88'" --no-create-info> c:\asql
mysqldump按导入:
mysqldump -u用户名 -p密码 -h主机 数据库 < 路径
案例:
mysql -uroot -p1234 db1 < c:\atxt
mysqldump导出表:
mysqldump -u用户名 -p密码 -h主机 数据库 表
案例:
mysqldump -uroot -p sqlhk9 a --no-data
-------------------------------------------------
mysqldump命令介绍
--all-databases, -A: 备份所有数据库
--databases, -B: 用于备份多个数据库,如果没有该选项,mysql dump 把第一个名字参数作为数据库名,后面的作为表名。使用该选项,mysql dum把每个名字都当作为数据库名。
--force, -f:即使发现sql错误,仍然继续备份
--host=host_name, -h host_name:备份主机名,默认为localhost
--no-data, -d:只导出表结构
--password[=password], -p[password]:密码
--port=port_num, -P port_num:制定TCP/IP连接时的端口号
--quick, -q:快速导出
--tables:覆盖 --databases or -B选项,后面所跟参数被视作表名
--user=user_name, -u user_name:用户名
--xml, -X:导出为xml文件
1备份全部数据库的数据和结构
mysql dump -uroot -p123456 -A >F:\allsql
2备份全部数据库的结构(加 -d 参数)
mysql dump -uroot -p123456 -A -d>F:\all_structsql
3备份全部数据库的数据(加 -t 参数)
mysql dump -uroot -p123456 -A -t>F:\all_datasql
4备份单个数据库的数据和结构(,数据库名mydb)
mysql dump -uroot -p123456 mydb>F:\mydbsql
5备份单个数据库的结构
mysql dump -uroot -p123456 mydb -d>F:\mydbsql
6备份单个数据库的数据
mysql dump -uroot -p123456 mydb -t>F:\mydbsql
7备份多个表的数据和结构(数据,结构的单独备份方法与上同)
mysql dump -uroot -p123456 mydb t1 t2 >f:\multablessql
8一次备份多个数据库
mysql dump -uroot -p123456 --databases db1 db2 >f:\muldbssql
还原部分分(1)mysql 命令行source方法 和 (2)系统命令行方法
1还原全部数据库:
(1) mysql 命令行:mysql >source f:\allsql
(2) 系统命令行: mysql -uroot -p123456 <f:\allsql
2还原单个数据库(需指定数据库)
(1) mysql >use mydb
mysql >source f:\mydbsql
(2) mysql -uroot -p123456 mydb <f:\mydbsql
3还原单个数据库的多个表(需指定数据库)
(1) mysql >use mydb
mysql >source f:\multablessql
(2) mysql -uroot -p123456 mydb <f:\multablessql
4还原多个数据库,(一个备份文件里有多个数据库的备份,此时不需要指定数据库)
(1) mysql 命令行:mysql >source f:\muldbssql
(2) 系统命令行: mysql -uroot -p123456 <f:\muldbssql
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)