日期:2014-05-16 浏览次数:20769 次
//获得Cell列不同的值
SqlCommand cmd = new SqlCommand();
cmd.Connection = m_SqlConn;
cmd.CommandText = "select distinct Cell from " + sTableName;
cmd.CommandType = CommandType.Text;
SqlDataAdapter sda = new SqlDataAdapter();
sda.SelectCommand = cmd;
DataSet ds = new DataSet();
sda.Fill(ds, sTableName);
int nDiffCellValueCount = ds.Tables[sTableName].Rows.Count;
//得到相同的Cell值的表
for (int i = 0; i < nDiffCellValueCount; i++ )
{
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = m_SqlConn;
cmd1.CommandText = "select * from Cell where Cell = " + ds.Tables[0].Rows[i][0].ToString();
cmd1.CommandType = CommandType.Text;
SqlDataAdapter sda1 = new SqlDataAdapter();
sda1.SelectCommand = cmd;
//记录下该DataSet对应的Cell值
_DataValue ds1 = new _DataValue(Convert.ToUInt64(ds.Tables[0].Rows[i][0]));
sda.Fill(ds1._DataSet, sTableName);
DataBaseValueAL.Add(ds1);
}