How should do? C # code
This. D_xs. ColumnHeadersDefaultCellStyle. Alignment=DataGridViewContentAlignment. MiddleCenter;
This. D_xs. ColumnHeadersDefaultCellStyle. Alignment=DataGridViewContentAlignment. MiddleCenter;
//form A data
String sql_str="SELECT sum (total amount to be) as AA, the sum (orders came pen) as BB sales TAB WHERE the FROM came megabite='famous brand shoe shoe kind of'" +
"UNION ALL SELECT sum (total amount to be) as AA, the sum (orders came pen) as BB sales TAB WHERE the FROM came megabite='fair maiden outfit industry" +
"UNION ALL SELECT sum (total amount to be) as AA, the sum (orders came pen) as BB sales TAB WHERE the FROM came megabite='less women's clothing industry" +
"UNION ALL SELECT sum (total amount to be) as AA, the sum (orders came pen) as BB sales TAB WHERE the FROM came megabite='men's toy industry" +
"UNION ALL SELECT sum (total amount to be) as AA, the sum (orders came pen) as BB sales TAB WHERE the FROM came megabite='sports leisure industry" +
"UNION ALL SELECT sum (total amount to be) as AA, the sum (orders came pen) as BB sales TAB WHERE the FROM came megabite='household life industry";
OleDbConnection conn=new OleDbConnection (" Provider=Microsoft. Jet. The OLEDB. 4.0; The Data Source=Data_tg. MDB ");
OleDbCommand CMD=new OleDbCommand (sql_str, conn);
Conn. The Open ();
Find_do=new OleDbDataAdapter ();
Find_do. SelectCommand=CMD;
Ds=new DataSet ();
Find_do. The Fill (ds, "rs");
//this. D_xs. DataMember="rs";
D_xs. RowHeadersWidth=150;
DataTable DataTable=ds. The Tables (" rs ");
DataRow dataRows.
DataRows=dataTable. NewRow ();
Pute dataRows [0]=dataTable.Com (" the Sum (AA) ", "true");
Pute dataRows [1]=dataTable.Com (" the Sum (BB) ", "true");
The dataTable. Rows. The Add (dataRows);
Enclosing d_xs. The DataSource=dataTable;
D_xs. TopLeftHeaderCell. Value="https://bbs.csdn.net/topics/megabite name";
D_xs. Rows [0]. HeaderCell. Value="https://bbs.csdn.net/topics/- boots shoes";
D_xs. Rows [1]. HeaderCell. Value="https://bbs.csdn.net/topics/fair maiden outfit industry";
D_xs. Rows [2]. HeaderCell. Value="https://bbs.csdn.net/topics/dirndl industry";
D_xs. Rows [3]. HeaderCell. Value="https://bbs.csdn.net/topics/men's toy industry";
D_xs. Rows [4]. HeaderCell. Value="https://bbs.csdn.net/topics/sports leisure industry";
D_xs. Rows [5]. HeaderCell. Value="https://bbs.csdn.net/topics/household life industry";
D_xs. Rows [6]. HeaderCell. Value="https://bbs.csdn.net/topics/combined";
D_xs. Columns [0]. The HeaderText="total amount to be";
D_xs. Columns [1]. The HeaderText="frequency of orders to be";
For (int I=0; i{
This. D_xs. Columns [I] SortMode=DataGridViewColumnSortMode. NotSortable;
}
Conn. Close ();
CodePudding user response:
Common column is the floor, according to the floorCodePudding user response:
Is to use SQL query?
SELECT sum (came sales statistics. The total amount to be) AS AA, the sum (be sales statistics. Order came pen) AS BB, sum (store brand sales summary. Collect transaction amount) AS CC
The FROM to be sales statistics INNER JOIN shops brand sales summary ON came sales statistics. Megabite=store brand sales summary. The summary megabite
WHERE to be sales statistics. Megabite='famous brand shoe shoe kind;
Such results are very strange, store brand sales summary. The summary transaction value is 100 now shows obviously is 9500 and I don't know is where come of?