private void SetDbName(RefreshDataCT composite) { string StrSQL = ""; StrSQL = "Select * From WebActions Where CompanyCode=" + composite.CompanyCode + " And ActionCode=1"; //composite.StrDebug=GetConnectionString(); using (DataTable dtWebTableCode = NmdDBAdapter.ExecuteSQL(StrSQL)) { composite.DbNameServer = ((string)dtWebTableCode.Rows[0]["DbNameServer"]).Trim(); composite.DbNameClient = ((string)dtWebTableCode.Rows[0]["DbNameClient"]).Trim(); } }
private void GetDataRefresh(RefreshDataCT composite) { string StrSQL = ""; string DbNameServer = ""; string DbNameClient = ""; if (composite.TableCode > 1000) { DbNameServer = composite.DbNameServer + ".dbo."; DbNameClient = composite.DbNameClient + ".dbo."; } StrSQL = "Select * From " + DbNameServer + "WebTableCode Where CompanyCode=" + composite.CompanyCode + " And TableCode=" + composite.TableCode; //composite.StrDebug=GetConnectionString(); using (DataTable dtWebTableCode = NmdDBAdapter.ExecuteSQL(StrSQL)) { composite.TableName = ((string)dtWebTableCode.Rows[0]["TableName"]).Trim(); composite.HasCreateTable = false; if ((int)dtWebTableCode.Rows[0]["TableDataVersion"] > composite.TableDataVersion) { composite.TableDataVersion = 0; composite.HasCreateTable = true; } composite.QueryCreateTable = ((string)dtWebTableCode.Rows[0]["QueryCreateTable"]).Trim(); composite.QueryBeforeExec1 = ((string)dtWebTableCode.Rows[0]["QueryBeforeExec1"]).Trim(); composite.QueryBeforeExec2 = ((string)dtWebTableCode.Rows[0]["QueryBeforeExec2"]).Trim(); composite.QueryAfterExec1 = ((string)dtWebTableCode.Rows[0]["QueryAfterExec1"]).Trim(); composite.QueryAfterExec2 = ((string)dtWebTableCode.Rows[0]["QueryAfterExec2"]).Trim(); composite.QueryAfterExec3 = ((string)dtWebTableCode.Rows[0]["QueryAfterExec3"]).Trim(); composite.DeleteKey = ((string)dtWebTableCode.Rows[0]["DeleteKey"]).Trim(); composite.IsCreateTmpTable = (Int16)dtWebTableCode.Rows[0]["IsCreateTmpTable"]; StrSQL = ((string)dtWebTableCode.Rows[0]["QueryGetData"]).Replace("@TableDataVersion", composite.TableDataVersion.ToString()); if (composite.TableCode > 1000) { StrSQL = ((string)StrSQL).Replace("@DbNameServer.dbo.", DbNameClient); } else { StrSQL = ((string)StrSQL).Replace("@DbNameServer.dbo.", DbNameServer); } } //composite.Dt = ExecuteSQL(StrSQL); //composite.MS = ToMemStream(ExecuteSQL(StrSQL)); composite.DataTableArray = ToMemStream(NmdDBAdapter.ExecuteSQL(StrSQL)).ToArray(); }