C# 用于sql查询的组formcollection键

C# 用于sql查询的组formcollection键,c#,sql,arrays,formcollection,C#,Sql,Arrays,Formcollection,我想知道是否可以对formcollection键进行分组,例如: FormCollection form = {table-columnA-G1, table-columnB-G1, table-columnC-G1, table-columnA-G2, table-columnB-G2, table-columnC-G2, table-columnA-G3, table-columnB-G3,

我想知道是否可以对formcollection键进行分组,例如:

 FormCollection form = {table-columnA-G1, table-columnB-G1, table-columnC-G1, table-columnA-G2,
                          table-columnB-G2, table-columnC-G2, table-columnA-G3, table-columnB-G3,
                            table-columnC-G3...}
我想对键进行分组,以便所有G1、G2和G3都是分开的,这样我就可以将键的值插入到表中,但不确定最好的方法。我曾尝试使用foreach循环,但无法获得所需的结果

所以我要写的查询应该是这样的

 SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText ="Update ColumnA SET ColumnA = value, ColumnB = value, ColumnC = value"