我正在使用 Oracle 10 G 数据库
Drop Table yassin;
Create Table yassin as Select
sad_gen.key_dec,
sad_gen.key_year,
sad_gen.sad_typ_proc,
sad_gen.sad_asmt_nber,
sad_gen.key_cuo,
sad_gen.sad_reg_nber,
sad_gen.sad_reg_date,
sad_gen.sad_asmt_date,
sad_gen.sad_dec_date,
sad_gen.sad_exporter,
sad_gen.sad_stat_val,
sad_gen.key_nber,
sad_gen.sad_itm_total,
sad_gen.sad_pack_total,
sad_gen.sad_consignee,
sad_gen.sad_cty_1dlp,
sad_gen.sad_tra_cty,
sad_gen.sad_cty_expcod,
sad_gen.sad_cty_destcod,
sad_gen.sad_tod_cod,
sad_gen.sad_cur_cod,
sad_gen.sad_tot_invoiced,
sad_gen.sad_tra_cod1,
sad_gen.sad_mot_bord,
sad_gen.sad_cuo_bord,
sad_gen.sad_total_taxes,
sad_gen.sad_reg_year,
sad_gen.sad_asmt_year,
sad_gen.sad_rcpt_nber,
sad_gen.sad_rcpt_date,
sad_gen.sad_loc_goods,
sad_gen.sad_lop_cod,
sad_gen.sad_whs_time
FROM sad_gen
WHERE
sad_gen.sad_num=:X
AND sad_gen.lst_ope='U';
SELECT * from yassin;
当我使用它时SET parameter X VALUE IN .NET with OleDbDataAdabtor
我得到的错误是ORA-01036: illegal variable name/number
这是我的职责。Query is upper is query Para 是保持参数值的结构 public DataTable GetTable(String Query,AsycudaParameter[] Para) {
OleDbConnection c = new OleDbConnection(ConnectionString);
c.Open();
OleDbDataAdapter da = new OleDbDataAdapter(Query, c);
for (int b = 0; b < Para.Length; b++)
{
if (Query.Contains(Para[b].name))
{
if (Para[b].Type == TypeCode.String)
{
da.SelectCommand.Parameters.Add(new OleDbParameter(Para[b].name, OleDbType.VarWChar));
da.SelectCommand.Parameters[da.SelectCommand.Parameters.Count - 1].Value = Para[b].value.ToString();
}
if (Para[b].Type == TypeCode.Decimal)
{
da.SelectCommand.Parameters.Add(new OleDbParameter(Para[b].name, OleDbType.Decimal));
da.SelectCommand.Parameters[da.SelectCommand.Parameters.Count - 1].Value = decimal.Parse(Para[b].value.ToString());
}
}
}
DataTable dt = new DataTable();
da.Fill(dt);
c.Close();
return dt;
}