public static DataSet GetDataSet(string processID, string sql, string strOrderKey, WsGetDataClient.WSGetData mgr, string fieldStr, string IsRepeatDown) { DataSet ds = new DataSet(); sql = encstr + DesEncrypt.Encrypt(sql); if (IsRepeatDown == "1") { string countsql = "select count(1) " + sql.Substring(sql.ToLower().IndexOf(" from ")); DataSet dscount = mgr.getDataSet(processID, countsql); long dtcount = 0; if (dscount != null && dscount.Tables.Count > 0) { dtcount = Convert.ToInt64(dscount.Tables[0].Rows[0][0]); } if (dtcount <= pgNum) { ds = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql)); } else { WebSvrGetDataAsync getDataSync = new WebSvrGetDataAsync(processID, dtcount, sql, strOrderKey, mgr, fieldStr); ds = getDataSync.returnDataSet(); } } else { ds = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql)); } return(ds); }
private DataTable getDataTable(string sql) { DataTable dt = new DataTable(); DataSet vsds = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(this.ProcessID, sql)); if (vsds.Tables.Count > 0) { return(vsds.Tables[0]); } else { return(dt); } }
/// <summary> /// 共同做的工作 /// </summary> /// private void getData(object sql) { while (true) { Monitor.Enter(this);//锁定,保持同步 DataSet dsre = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql as string)); i = i + 1; if (ds == null) { ds = dsre.Copy(); } else { foreach (DataRow row in dsre.Tables[0].Rows) { ds.Tables[0].Rows.Add(row.ItemArray); } if (i == pgnum) { OnNumberClear(this, new EventArgs());//引发完成事件 } } Monitor.Exit(this);//取消锁定 Thread.Sleep(5); } }
public static DataSet GetDataSet(string processID, string sql, string strOrderKey, WsGetDataClient.WSGetData mgr, string fieldStr) { DataSet ds = new DataSet(); sql = encstr + DesEncrypt.Encrypt(sql); ds = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql)); return(ds); }
public static DataTable getDataTable(string processID, WsGetDataClient.WSGetData mgr, string sql) { DataTable dt = new DataTable(); DataSet ds = new DataSet(); sql = encstr + DesEncrypt.Encrypt(sql); ds = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql)); if (ds.Tables.Count > 0) { dt = ds.Tables[0]; } return(dt); }
private void syncGetDataSet(string processID, long dtcount, string sql, string strOrderKey, WsGetDataClient.WSGetData mgr) { sql = WebSvrGetData.encstr + DesEncrypt.Encrypt(sql); string dbtype = mgr.getDBType(processID); string vssql = ""; if (dbtype == "ora") { vssql = "select * from ( {0} )z1 where rownum>{1} and rownum<={2} "; } else { if (string.IsNullOrEmpty(strOrderKey)) { throw new Exception("数据量过大,请联系开发人员调用异步加载方式!"); } vssql = @"select top {1} * from ( select top {2} * from ({0}) z1 order by {3}) z2 order by {3} desc "; } for (int m = 0; m < loadNum; m++) { long longs = m * WebSvrGetData.pgNum; long longe = (m + 1) * WebSvrGetData.pgNum; if (dbtype == "ora") { sql = string.Format(vssql, sql, longs + "", longe + ""); } else { sql = string.Format(vssql, sql, WebSvrGetData.pgNum, longe + "", strOrderKey); } DataSet dsre = StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql)); if (ds == null) { ds = dsre.Copy(); } else { foreach (DataRow row in dsre.Tables[0].Rows) { ds.Tables[0].Rows.Add(row.ItemArray); } } } }
public DataSet getData(WsGetDataClient.WSGetData mgr, string processID, string sql) { sql = WebSvrGetData.encstr + DesEncrypt.Encrypt(sql); return(StringToDataSet.getDataSetFromZipDataFormat(mgr.getZipDataFormatByte(processID, sql))); }