0

何らかの理由で、以下のコードは ORA-01036 を返します: ページを実行しようとするたびに不正な変数名/番号。cmd.BindByName = true を読み取る部分を削除しようとしましたが、すべての変数がバインドされているわけではない別のエラーが返されます。以下は私のコードです:

try
{
    int row;
    DataSet dataset = new DataSet();

    OracleCommand cmd = new OracleCommand(sql, conn);

    for (row = 0; row < gvParameters.Rows.Count; row++)
    {                    
        TextBox text = (TextBox)gvParameters.Rows[row]
            .FindControl("txtParamValue");
        cmd.Parameters.Add(gvParameters.Rows[row].Cells[1].Text, text.Text);
    }
    cmd.BindByName = true;

    OracleDataAdapter adapter = new OracleDataAdapter();
    adapter.SelectCommand = cmd;
    adapter.Fill(dataset);

    if (conn.State == ConnectionState.Open)
    {
        conn.Close();
        conn.Dispose();
    }

    gvResults.DataSource = dataset.Tables[0];
    gvResults.DataBind();
}
catch (Exception ex)
{
    X.MessageBox.Alert("Information", ex.ToString()).Show();
    conn.Close();
    conn.Dispose();
}

これが私が使用しているクエリです。

SELECT
    *
FROM
(
  SELECT
    ROW_NUMBER() OVER (ORDER BY NULL) AS No
    , cspOutput.*   
  FROM   
  (     
  SELECT DISTINCT *
FROM
(

SELECT DISTINCT 
      wl.specname
      ,wep.paramnamename dataname
      ,wep.paramvalue || ' - ' || NVL(ht.name, ' ') datavalue
      ,wep.paramsequence
      ,e.employeename
      ,e.fullname
      --,'WIP' AS Type
      ,we.equipmentname
      ,we.trackinemployeename      
      ,c.containername
FROM container c
JOIN a_wiplot wl ON wl.containerid = c.containerid
JOIN a_wiplotdetails wld ON wl.wiplotid = wld.wiplotid
JOIN a_wiplotdetailswafers wldw ON wld.wiplotdetailsid = wldw.wiplotdetailsid
JOIN a_wipequipment we ON we.containerid = wl.containerid
JOIN a_wipequipmentparams wep ON we.wipequipmentid= wep.wipequipmentid
LEFT JOIN otherdb.hw_inventory ht ON wep.paramvalue = ht.BARCODE
LEFT JOIN employee e ON we.trackinemployeename = e.employeename
WHERE c.containername = ?lotID AND wep.paramvalue IS NOT NULL
UNION ALL
SELECT DISTINCT 
      hml.specname
      ,wep.paramnamename dataname
      ,wep.paramvalue || ' - ' || NVL(ht.name, ' ')  datavalue
      ,wep.paramsequence
      ,e.employeename
      ,e.fullname
      --,'TrackInOut' AS Type
      ,we.equipmentname      
      ,we.trackinemployeename      
      ,c.containername
FROM container C
JOIN a_wipequipmenthistory we ON c.containerid = we.containerid OR c.splitfromid  = we.containerid
JOIN historymainline HML on hml.historysummaryid = we.wipequipmentlinkid AND (hml.historyid = c.containerid OR hml.historyid = c.splitfromid)
JOIN a_wipequipmentparamshistory wep ON wep.wipequipmenthistoryid = we.wipequipmenthistoryid
LEFT JOIN otherdb.hw_inventory ht ON wep.paramvalue = ht.BARCODE
LEFT JOIN employee e ON we.trackinemployeename = e.employeename
WHERE c.containername = ?lotID AND wep.paramvalue IS NOT NULL
) 
)cspOutput
)
WHERE No BETWEEN (((?BLOCKOF200ROWS - 1) * 200) + 1) AND (?BLOCKOF200ROWS * 200)

みんな助けてくれてありがとう。

4

1 に答える 1