-2
我面對這個非常簡單的查詢這個問題。我不明白其背後的原因。ORA-01036:一個簡單的查詢的非法變量名稱/數字
string strCon=myConnectionString;
string strSql=string.Format("select * from tblUser where UserName like '{0}%'",":Name");
OracleConnection conn = new OracleConnection(strCon);
OracleCommand command = null;
command = new OracleCommand(strSql, conn);
command.CommandType = CommandType.Text;
//Getting this value from a function it is a string type variable
val = val.Trim().ToUpper().Replace("'", "''");
command.Parameters.Add("Name", OracleType.VarChar, 80).Value = val;
DataSet dsEmail = new DataSet();
OracleDataAdapter da = new OracleDataAdapter(command);
da.Fill(dsEmail);
select * form ?? – ajmalmhd04
在添加Name參數後,你的'strSql'是什麼?和**選擇* FORM **?另外考慮使用[參數化的sql](http://www.codinghorror.com/blog/2005/04/give-me-parameterized-sql-or-give-me-death.html) –
請考慮一些其他的方式這樣做。任何人都可以注入一些SQL ... – Peter