为什么在执行此 VB.NET 代码时出现此 Oracle 错误?
Ora-01008: 所有变量未绑定
Dim szSQLEvt As String = ""
Dim sbEvt As New StringBuilder
sbEvt.Append("INSERT INTO WORKORDERHISTORY (WORKORDERNUMBER, WORKORDEREVENT, EVENTDATE, USERNAME) ")
sbEvt.Append("VALUES(:EvtWorkOrderNumber, :WorkOrderEvent, :EventDate, :EvtUsername) ")
szSQLEvt = sbEvt.ToString
Dim cmdEvt As New OracleCommand
cmdEvt.BindByName = True
cmdEvt.Connection = conn
cmdEvt.CommandText = szSQLEvt
cmdEvt.Parameters.Add(":EvtWorkOrderNumber", Oracle.DataAccess.Client.OracleDbType.Varchar2)
cmdEvt.Parameters.Item(":EvtWorkOrderNumber").Value = szNewWONum
cmdEvt.Parameters.Add(":WorkOrderEvent", Oracle.DataAccess.Client.OracleDbType.Varchar2)
cmdEvt.Parameters.Item(":WorkOrderEvent").Value = "assigned"
cmd.Parameters.Add(":EventDate", Oracle.DataAccess.Client.OracleDbType.Date)
cmd.Parameters.Item(":EventDate").Value = Today
cmd.Parameters.Add(":EvtUsername", Oracle.DataAccess.Client.OracleDbType.Varchar2)
cmd.Parameters.Item(":EvtUsername").Value = szCurrUser
If conn.State <> ConnectionState.Open Then conn.Open()
cmdEvt.ExecuteNonQuery()
conn.Close()