在sql查询中,它很好......并且运行正常..但是一旦它进入...错误就出现了“名为'STATUS'的列已经属于这个DataTable” 这是sql查询
Dim sql As String = " SELECT DISTINCT LED.IDX As IDX, CORPCODE, UNITTYPECODE, UPPERFORMATIONCODE, FORMATIONCODE, LED.UNITCODE As UNITCODE,LED.STORECODE As STORECODE, LED.SECTIONNO As SECTIONNO, LED.PARTNO As PARTNO, "
sql &= " LED.BATCHNO As BATCHNO, UNITITEMCATEGORYCODE, LEDGERDATE, ENTITLEMENT, HOLDING, SURPLUS, SHORTAGE, COSTHOLDING, COSTENTITLEMENT, INITIALSTOCK, EMPLOYQTY, FIGHTQTY, ITEMAGE1, ITEMAGE2, ITEMAGE3,"
sql &= " ITEMAGE4, LED.BAH_BEREK, LED.JENIS_BEREK, JPTD_NO, LASTUPDATE, LED.ITEMTYPECODE As ITEMTYPECODE, LED.TOOLTYPECODE As TOOLTYPECODE, LED.PAKAIBHGCODE, LED.PAKAICODE, ITEMNIDX, LED.CREATEID As CREATEID, "
sql &= " LED.UPDATEID As UPDATEID, LED.CREATEDATE As CREATEDATE, LED.UPDATEDATE As UPDATEDATE, "
sql &= " USERID, RANKCODE, SERVICENO, USERNAME, DESIGNATIONCODE, PASSWORD, "
sql &= " 'OPER' AS GROUPCODE,5 AS ACESSID, 0 AS STATUS "
sql &= " FROM (LEDGER AS LED) "
sql &= " LEFT JOIN NUSER On NUSER.USERID = LED.UPDATEID WHERE (1=1) "
If condation <> "" Then
sql += condation
End If
sql &= " UNION SELECT DISTINCT LED.IDX As IDX, CORPCODE, UNITTYPECODE, UPPERFORMATIONCODE, FORMATIONCODE, LED.UNITCODE As UNITCODE, LED.STORECODE As STORECODE, LED.SECTIONNO As SECTIONNO, LED.PARTNO As PARTNO, "
sql &= " LED.BATCHNO As BATCHNO, UNITITEMCATEGORYCODE, LEDGERDATE, ENTITLEMENT, HOLDING, SURPLUS, SHORTAGE, COSTHOLDING, COSTENTITLEMENT, INITIALSTOCK, EMPLOYQTY, FIGHTQTY, ITEMAGE1, ITEMAGE2, ITEMAGE3,"
sql &= " ITEMAGE4, LED.BAH_BEREK, LED.JENIS_BEREK, JPTD_NO, LASTUPDATE, LED.ITEMTYPECODE As ITEMTYPECODE, LED.TOOLTYPECODE As TOOLTYPECODE, LED.PAKAIBHGCODE, LED.PAKAICODE, ITEMNIDX, LED.CREATEID As CREATEID, "
sql &= " LED.UPDATEID As UPDATEID, LED.CREATEDATE As CREATEDATE, LED.UPDATEDATE As UPDATEDATE,"
sql &= " '','','','','','','OPER',5 , STATUS "
sql &= " FROM LEDGER_HISTORY LED WHERE (1=1) "
If condation <> "" Then
sql += condation
End If
for process.i不知道需要修复的地方..任何人都可以帮我解决这个问题。这是流程代码:
Dim dt As New DataTable
Dim cond As String = ""
If cboFormasi.SelectedValue.ToString.Length > 0 Then
cond &= " AND led.FORMATIONCODE=" & ParseStringToSQL(cboFormasi.SelectedValue)
End If
If cboUnit.SelectedValue.ToString.Length > 0 Then
cond &= " AND led.UNITCODE=" & ParseStringToSQL(cboUnit.SelectedValue)
End If
Try
dt = objLejer.ExporttAll(cond)
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
dt.Columns.Add("BATCHDATE")
dt.Columns.Add("NSNNO")
dt.Columns.Add("MFGNO")
dt.Columns.Add("ITEMCATEGORYCODE")
dt.Columns.Add("MATERIALTYPECODE")
dt.Columns.Add("Image")
dt.Columns.Add("SIAPSIAGA")
dt.Columns.Add("MEASURECODE")
dt.Columns.Add("ITEM_IMAGE")
dt.Columns.Add("MIS_TAG")
dt.Columns.Add("MIS_NAME")
dt.Columns.Add("SFS_TAG")
dt.Columns.Add("TSNSTSB")
dt.Columns.Add("FLAG")
dt.Columns.Add("COST")
dt.Columns.Add("ITEMNAME")
dt.Columns.Add("OLDPARTNO")
dt.Columns.Add("ISDEL")
dt.Columns.Add("STATUS")
dt.AcceptChanges()
希望有人能帮助我解决这个问题