1.
1
2
3
2.
ppt
3.
SQL
SQL
private GridppReport Report = new GridppReport (); //1.
public void showreport()
{
//2.
//Report.LoadFromFile(GridppReportDemo.Utility.GetReportTemplatePath() +
"program\ParamQuerySQL2.grf");
Report.LoadFromFile( Application .StartupPath + "\1.grf" );
//3.
Report.DetailGrid.Recordset.ConnectionString =
"Provider=SQLOLEDB.1;Password=xxxxxx;Persist Security Info=True;User ID= xxxxxx;Initial
Catalog=ry_powder;Data Source=192.168.8.18;Use Procedure for Prepare=1;Auto
Translate=True;Packet Size=4096;Workstation ID=UNCLE13;Use Encryption for Data=False;Tag
with column collation when possible=False" ;
//4.
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler (MyReport);
//5.
axGRPrintViewer1.Report = Report;
}
private void MyReport() //
{
string startdate = dateTimePicker1.Value.ToString( "yy-MM-dd 0:00:00" );
string enddate = dateTimePicker2.Value.ToString( "yy-MM-dd 23:59:59" );
string SQL = "SELECT * FROM production_material_lose WHERE unit = '" +
comboBox1.Text + "' AND unit_2 = '" + comboBox2.Text + "' AND materialtype = '" +
comboBox3.Text + "' AND typedetail = '" + comboBox4.Text + "' and uploaddate >= '" +
startdate + "' and uploaddate <='" + enddate + "'" ;
// SQL
Report.DetailGrid.Recordset.QuerySQL = SQL;
}