public void initData() { SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM [Promocje]", conn); DataSet set = new DataSet(); set.Reset(); adapter.Fill(set); DataTable datable = set.Tables["Table"]; int i = 0; this.max = datable.Rows.Count; DBHelper.Log(this.max.ToString()); datas = new object[max][]; foreach (DataRow dr in datable.Rows) { datas[i] = new object[6]; int v = 0; foreach (string p in columns) { datas[i][v] = dr[p]; v++; } i++; } dualNumerator = new DualNumerator(datas, max); initTexts(dualNumerator.GetFirst()); }
public void initData() { Auth a = Auth.GetInstance(); string strcmd = "SELECT * FROM [Zamowienia] WHERE 1=1 "; if (!a.IsAdmin()) { strcmd += String.Format(" AND id_user = {0}", a.selectedUserId); } SqlDataAdapter adapter = new SqlDataAdapter(strcmd, conn); DataSet set = new DataSet(); set.Reset(); adapter.Fill(set); DataTable datable = set.Tables["Table"]; int i = 0; this.max = datable.Rows.Count; DBHelper.Log(this.max.ToString()); datas = new object[max][]; foreach (DataRow dr in datable.Rows) { datas[i] = new object[columns.Length]; int v = 0; foreach (string p in columns) { datas[i][v] = dr[p]; v++; } i++; } dualNumerator = new DualNumerator(datas, max); initTexts(dualNumerator.GetFirst()); }