请参阅以下代码以供参考。
我在下面的代码中收到此错误,我已经知道为什么,我只是不知道如何在SQL中加入数据集。
Error1运算符'+'未定义类型'String'和'System.Data.DataTable'。
Dim sql3 As String = "select DISTINCT A.CustomerNum, A.CustomerName, A.lngAmkorID AS AmkorID, A.lngAmkorSubID AS SubID, A.strLineCode AS LineCode, A.Device, A.WaferRunNum, A.PkgLd, A.strPO AS PO, A.strWIPLotNumber as WIPLotNo, A.strWIPLotDoubleCheckCode AS WIPDCC, " & _
"J.strOperatorName AS CurrOper, J.strRawDateCode AS eMES_DC, J.strRawTraceCode AS eMES_TC, " & _
"K.ReferenceStnName, " & _
"D.CMMFDT AS MfgDate, " & _
"C.DateCode AS Marked_DC, 'HardcodedDC' = CASE WHEN C.HardCoded <> 0 THEN 'Hardcoded' ELSE '' END," & _
"C.TraceCode as encicledT, 'HardcodedT' = CASE WHEN C.bolTCHardcoded <> 0 THEN 'Hardcoded' ELSE '' END," & _
"C.SCode as encicledU, 'HardcodedU' = CASE WHEN C.bolSCHardcoded <> 0 THEN 'Hardcoded' ELSE '' END," & _
"C.SeqCode as encicledQ, 'HardcodedQ' = CASE WHEN C.bolQCHardcoded <> 0 THEN 'Hardcoded' ELSE '' END," & _
"'Status' = CASE" & _
"WHEN B.Status = 0 THEN 'NEW LOT'" & _
"WHEN B.Status = 1 THEN 'INCOMPLETE MID'" & _
"WHEN B.Status = 2 THEN 'COMPLETE MID'" & _
"WHEN B.Status = 3 THEN 'DC PROCESSED'" & _
"WHEN B.Status = 5 THEN 'MARKED'" & _
"END," & _
"'HOLD' = CASE WHEN B.Hold <> 0 THEN 'ON HOLD' ELSE '' END," & _
"D.CMMKDT AS MarkDate, H.strILNNo AS MESA_ILN, " & _
"J.strStation AS Station, J.strStatus_01 AS Status1, J.strStatus_02 AS Status2, " & _
"'UnitQty' = CASE" & _
"WHEN J.lngShippingOutTotalGoodQuantity <> 0 THEN J.lngShippingOutTotalGoodQuantity" & _
"WHEN J.lngShippingGoodEOH <> 0 THEN J.lngShippingGoodEOH" & _
"WHEN I.lngDieQuantity <> 0 THEN I.lngDieQuantity" & _
"WHEN J.lngCurrentDieGoodEOH <> 0 THEN J.lngCurrentDieGoodEOH" & _
"ELSE 0" & _
"End" & _
"from tblMIDCustomerLot A" & _
"INNER JOIN tblMIDExt B on A.lngAmkorID = B.lngAmkorID AND A.lngAmkorSubID = B.lngAmkorSubID and A.strWIPLotNumber = B.strWIPLotNumber COLLATE SQL_Latin1_General_CP1_CS_AS" & _
"INNER JOIN tblText C on A.lngAmkorID = C.lngAmkorID AND A.lngAmkorSubID = C.lngAmkorSubID and A.strWIPLotNumber = C.strWIPLotNumber COLLATE SQL_Latin1_General_CP1_CS_AS" & _
"LEFT JOIN " + ***ds.Tables("AMDSLot")*** + " D ON A.lngAmkorID = D.CMAMKID" & _
"AND A.lngAmkorSubID = D.CMSUBID" & _
"AND A.strWIPLotNumber = D.CMCLTN COLLATE SQL_Latin1_General_CP1_CS_AS" & _
"AND CAST(C.ReferenceStn AS INT)= D.CMREFS " & _
"LEFT JOIN dbDownload.MesLib.tblCrossRefILNAmkorID H ON A.lngAmkorID = H.lngWipAmkorId AND A.lngAmkorSubID = H.intWipSubId" & _
"LEFT JOIN dbDownload.MesLib.tblSplitAndCombineChangeLog I ON A.lngAmkorID = I.lngToAmkorID AND A.lngAmkorSubID = I.lngToAmkorSubID AND I.strType = 'COMBINE'" & _
"INNER JOIN " + ***ds.Tables("Table1")*** + " J ON A.lngAmkorID = J.lngAmkorID AND A.lngAmkorSubID = J.lngAmkorSubID" & _
"LEFT JOIN P1Common.dbo.tblReferenceStation K ON A.CustomerNum = K.CustomerCode AND A.CustomerName = K.CustomerName and C.ReferenceStn = K.ReferenceStn" & _
"where (C.DateCode <> '' or C.TraceCode <> '' or C.SCode <> '' or C.SeqCode <> '')" & _
"AND C.ReferenceStn <> '*FIRST'" & _
"order by A.strWIPLotNumber, A.strWIPLotDoubleCheckCode"
Dim dataadapter3 As New SqlDataAdapter(sql3, connection)
提前致谢! :)