As title, the export ecexl form, how to implement the "serial number" this column automatically according to the exported data rows, from 1 since the growth?
My background code derived the following
The DataSet TaiZhangds=objDB. OpenData (strSQL);
If (TaiZhangds. Tables [0]. Rows. Count & gt; 0)
{
for (int i=0; i
{
DataRow drProc=TaiZhangds. Tables [0]. Rows [I];
Cells [rowIndex, 1]. PutValue (drProc [r]. "LY_BuMen" ToString ());
Cells [rowIndex, 2]. PutValue (drProc [r]. "BGYP_Name" ToString ());
Cells [rowIndex, 3]. PutValue (drProc [r]. "TypeName" ToString ());
Cells [rowIndex, 4] PutValue (drProc [r]. "BGYP_PinPai" ToString ());
Cells [rowIndex, 5]. PutValue (drProc [r]. "BGYP_Price" ToString ());
Cells [rowIndex, 6]. PutValue (drProc [r]. "BGYP_Count" ToString ());
Cells [rowIndex, 7]. PutValue (drProc [r]. "LY_Date" ToString ());
RowIndex++;
}
CodePudding user response:
Cells [rowIndex, 0] PutValue (I + 1);
You don't have an I count there? Use it tag line
CodePudding user response:
Derived directly from the database when ID on the field
CodePudding user response:
reference 1st floor jjkk168 response: cells [rowIndex, 0] PutValue (I + 1); You don't have an I count there? Just use it mark Haha, thank you! According to you so that can achieve! Thank you! CodePudding user response:
refer to the second floor wangjun8868 response: when derived directly from the database ID on the field of the Could you tell me how to use the database ID on the field? CodePudding user response:
reference 4 floor dzs0331 response: Quote: refer to the second floor wangjun8868 response: Derived directly from the database when the ID on the field line Could you tell me how to use the database ID on the field? The data source is not read from the database CodePudding user response:
Don't know you this can fit in peace under the premise of the cell CodePudding user response:
Datatable add a column, and then traverse the existing datatable, add the value 1, no