这段是在写什么?
晕倒了...程序代码:
Private Function GetExcelSQL(ByVal blFCSTOrder As Boolean) As String Dim mySQL As String Dim strColorIndex As String Dim strColorIndexJoinTable As String If blFCSTOrder = True Then strColorIndex = "ISNULL(D.Priority, 4) AS ColorIndex" strColorIndexJoinTable = "LEFT OUTER JOIN tblBasStatusDesc AS G ON D.Priority = G.Status AND G.Category = 'ProjectFCST' " Else strColorIndex = "ISNULL(A.Phase, 10) AS ColorIndex" strColorIndexJoinTable = "LEFT OUTER JOIN tblBasStatusDesc AS G ON A.Phase = G.Status AND G.Category = 'ProjectPhase' " End If mySQL = "SELECT * FROM (" mySQL += "SELECT A.ProjectNo, A.NPINumber, A.DevpType, A.ProjectType, A.CustomerNo, A.DeviceNo, A.Platform01, A.Platform02, A.Platform03, A.ProductType, A.RequestService, A.Div, " mySQL += "A.EngineerNo, A.ConsultantNo, A.SupervisorNo, A.SalesNo, A.ApplicationDate, A.KickoffDate, A.EstFinishDate, A.DepartmentNo, A.Remark, A.ReleaseStatus, A.ReleaseStatusDate, " mySQL += "A.Phase, A.PhaseDate, " mySQL += "B.ProbeCard, B.ProbeCardPlanFrom, B.ProbeCardPlanTo, B.ProbeCardPlanRevise, B.ProbeCardActualFrom, B.ProbeCardActualTo, B.ProbeCardActualRevise, B.ProbeCardActualReady, B.ProbeCardHours, B.ProbeCardMemo, " mySQL += "B.DutBoard, B.DutBoardPlanFrom, B.DutBoardPlanTo, B.DutBoardPlanRevise, B.DutBoardActualFrom, B.DutBoardActualTo, B.DutBoardActualRevise, B.DutBoardActualReady, B.DutBoardHours, B.DutBoardMemo, " mySQL += "B.ChangeKit, B.ChangeKitPlanFrom, B.ChangeKitPlanTo, B.ChangeKitPlanRevise, B.ChangeKitActualFrom, B.ChangeKitActualTo, B.ChangeKitActualRevise, B.ChangeKitHours, B.ChangeKitMemo, " mySQL += "B.TestProgram, B.TestProgramPlanFrom, B.TestProgramPlanTo, B.TestProgramPlanRevise, B.TestProgramActualFrom, B.TestProgramActualTo, B.TestProgramActualRevise, B.TestProgramActualReady, B.TestProgramHours, B.TestProgramMemo, " mySQL += "B.LaserRepair, B.LaserRepairPlanFrom, B.LaserRepairPlanTo, B.LaserRepairPlanRevise, B.LaserRepairActualFrom, B.LaserRepairActualTo, B.LaserRepairActualRevise, B.LaserRepairHours, B.LaserRepairMemo, " mySQL += "B.TPVerification, B.TPVerificationPlanFrom, B.TPVerificationPlanTo, B.TPVerificationPlanRevise, B.TPVerificationActualFrom, B.TPVerificationActualTo, B.TPVerificationActualRevise, B.TPVerificationActualReady, B.TPVerificationHours, B.TPVerificationMemo, " mySQL += "B.Correlation, B.CorrelationPlanFrom, B.CorrelationPlanTo, B.CorrelationPlanRevise, B.CorrelationActualFrom, B.CorrelationActualTo, B.CorrelationActualRevise, B.CorrelationHours, B.CorrelationMemo, " mySQL += "B.ReleaseMeeting, B.ReleaseMeetingPlanFrom, B.ReleaseMeetingPlanTo, B.ReleaseMeetingPlanRevise, B.ReleaseMeetingActualFrom, B.ReleaseMeetingActualTo, B.ReleaseMeetingActualRevise, B.ReleaseMeetingHours, B.ReleaseMeetingMemo, " mySQL += "C.TestRate, C.CUP, C.TGResolution, C.Site, C.Channel, C.Temperature, C.AddOnModule, C.VM, C.TransInTester, C.ProductTypeDesc1, C.ProductTypeDesc2, " mySQL += "C.DevpCategory, C.MixSignal, C.WaferInch, C.ProbeCardNo, C.DutBoardNo, C.PadCount, C.NiddleCount, C.DataCollectDate, C.PackageType, C.PackageType2, " mySQL += "D.FCST, D.Schedule AS FCSTSchedule, D.Priority, ISNULL(D.Priority, 4) AS FCSTOrder, " mySQL += "E.FormDate, E.FirstLot, E.SecondLot, E.ThirdLot, E.FineTune, E.FTSec, E.CPSec, " mySQL += "F.CustomerEngSName, F.CustomerChiSName, " mySQL += strColorIndex & ", G.StatusDesc AS PhaseDesc " mySQL += "FROM tblProject AS A INNER JOIN tblProjectWorkPlan AS B ON A.ProjectNo = B.ProjectNo " mySQL += "LEFT OUTER JOIN tblProjectProductInfo AS C ON A.ProjectNo = C.ProjectNo " mySQL += "LEFT OUTER JOIN tblProjectFCST AS D ON A.ProjectNo = D.ProjectNo " mySQL += "LEFT OUTER JOIN tblProjectReleaseLots AS E ON A.ProjectNo = E.ProjectNo " mySQL += "LEFT OUTER JOIN tblMstCustomerPublic F ON A.CustomerNo = F.CustomerNo " mySQL += strColorIndexJoinTable mySQL += "WHERE " If radReportTD.Checked = True Then mySQL += "A.DevpType = 'TD' " Else mySQL += "A.DevpType = '客戶' " End If mySQL += "AND A.ReleaseStatus < 4) AS myTable " mySQL += hdfSort.Value Return mySQL End Function