//--------------------------------------------------------------------------------------- // 1.ID : Gf_Only_Display // 2.Input Value : Conn Connection, Sc Collection, sQuery String, // {iDupCnt Long}, {nCheckControl Collection}, {mCheckControl Collection}, // {MsgChk Boolean}, {EvenRowChk Boolean} // 3.Return Value : Boolean // 4.Create Date : // 5.Modify Date : // 6.Comment : Only Display //--------------------------------------------------------------------------------------- public bool Gf_Only_Display(ADODB.Connection Conn, Collection Sc, string sQuery, int iDupCnt, Collection nCheckControl, Collection mCheckControl, bool MsgChk, bool EvenRowChk) { bool returnValue = false; SpreadCommon SpreadCommon = new SpreadCommon(); MasterCommon MasterCommon = new MasterCommon(); int JJ; int j; int lRowCount; int lColCount; string sMsg; string[] sTemp; string sSpreadClip; ADODB.Recordset AdoRs; object ArrayRecords; //Db Connection Check if (Conn.State == 0) { if (GeneralCommon.GF_DbConnect() == false) { returnValue = false; } return(returnValue); } try { if (nCheckControl != null) { sMsg = MasterCommon.Gf_Ms_NeceCheck(nCheckControl); if (sMsg != "OK") { sMsg = "必须输入 " + sMsg.Trim() + " ...!!!"; GeneralCommon.Gp_MsgBoxDisplay(sMsg, "", ""); returnValue = false; return(returnValue); } } if (mCheckControl != null) { sMsg = MasterCommon.Gf_Ms_NeceCheck2(mCheckControl); if (sMsg != "OK") { sMsg = "输入的项目必须符合 " + sMsg.Trim() + " 的长度...!!!"; GeneralCommon.Gp_MsgBoxDisplay(sMsg, "", ""); returnValue = false; return(returnValue); } } AdoRs = new ADODB.Recordset(); FarPoint.Win.Spread.FpSpread with_1 = (FarPoint.Win.Spread.FpSpread)Sc["Spread"]; returnValue = true; with_1.Sheets[0].RowCount = 0; //with_1.ReDraw = false; with_1.Sheets[0].RowCount = 0; Cursor.Current = Cursors.WaitCursor; //Ado Execute AdoRs.Open(sQuery, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1); if (AdoRs.BOF || AdoRs.EOF) { if (MsgChk) { GeneralCommon.Gp_MsgBoxDisplay("无法找到该资料...!!!", "I", ""); } returnValue = false; //with_1.ReDraw = true; AdoRs.Close(); AdoRs = null; Cursor.Current = Cursors.Default; return(returnValue); } ArrayRecords = AdoRs.GetRows(); AdoRs.Close(); AdoRs = null; if (iDupCnt > 0) { sTemp = new string[iDupCnt + 1]; } if ((AdoRs.RecordCount - 1) >= 0) { with_1.Sheets[0].RowCount = AdoRs.RecordCount; for (lRowCount = 0; lRowCount <= AdoRs.RecordCount - 1; lRowCount++) { sSpreadClip = ""; for (lColCount = iDupCnt; lColCount <= AdoRs.Fields.Count; lColCount++) { sSpreadClip = sSpreadClip + AdoRs.Fields[lColCount].Value.ToString() + '\t'; } with_1.Sheets[0].SetClip(lRowCount, 0, lRowCount, lColCount, sSpreadClip); } } if (EvenRowChk) { SpreadCommon.Gp_Sp_EvenRowBackcolor((FarPoint.Win.Spread.FpSpread)Sc["Spread"], 0); } //.OperationMode = FPSpread.OperationModeConstants.OperationModeRow //with_1.ReDraw = true; returnValue = true; Cursor.Current = Cursors.Default; return(returnValue); } catch (Exception ex) { AdoRs = null; returnValue = false; Cursor.Current = Cursors.Default; GeneralCommon.Gp_MsgBoxDisplay((string)("Gf_Only_Display Error : " + ex.Message), "", ""); } return(returnValue); }