给datagridview中添加序号(在datagrid中添加、在sql中添加)

在datagridview中添加

 private void dgvSummary_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
              SolidBrush b = new SolidBrush(this.dgvSummary.RowHeadersDefaultCellStyle.ForeColor);
              e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.dgvSummary.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 20,         e.RowBounds.Location.Y + 4);
        }

  

在sql中添加

ROW_NUMBER() OVER (ORDER BY p.manfac ASC) AS id,

  给datagridview中添加序号(在datagrid中添加、在sql中添加)

 

给datagridview中添加序号(在datagrid中添加、在sql中添加)

上一篇:Mysql四种隔离级别


下一篇:Oracle根据已经存在的数据生成INSERT语句