?? ycl.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// ycl 的摘要說明
/// </summary>
public class ycl
{
public ycl()
{
//
// TODO: 在此處添加構造函數(shù)邏輯
//
}
public void get_GDITOGDP(DataSet ds,DataSet dt)
{
int Count_R = ds.Tables[0].Rows.Count;//ds的行數(shù)
int Count_C = ds.Tables[0].Columns.Count;//ds的列數(shù)
int dt_Count_C = dt.Tables[0].Columns.Count;//讀取dt的列數(shù)
//定義數(shù)組
float[,] values = new float[Count_R, Count_C];
float[,] temp = new float[Count_R, Count_C];
//定義變量
int i, j;
//讀取ds數(shù)據(jù)集里的數(shù)據(jù)到values數(shù)組中
for (i = 0; i < Count_R; i++)
for (j = 0; j < Count_C; j++)
values[i, j] = Convert.ToSingle(ds.Tables[0].Rows[i][j].ToString());
for (i = 0; i<Count_R; i++)
temp[i, 0] = values[i, 0];
for (j = 1; j < Count_C; j++)
temp[0, j] = Convert.ToSingle(100);
for(i=1;i<Count_R;i++)
for (j = 1; j < Count_C; j++)
temp[i, j] = Convert.ToSingle(values[i, j] / values[i-1, j] * temp[i-1,j]);
//把計算后的結果,寫入到dt數(shù)據(jù)集中
for (i = 0; i<Count_R; i++)
{
DataRow newRow = dt.Tables[dt.Tables[0].ToString()].NewRow();
for(j=0;j< Count_C;j++)
newRow[j] = temp[i,j];
dt.Tables[dt.Tables[0].ToString()].Rows.Add(newRow);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -