To cmsoft(韦小宝是我的老乡)(.net&java):我换成了string CommandText = "select * from tzhtable where age<@myage"; myCommand.Parameters.Add("@myage",OracleType.Int16).Value=13; 还是不行。 TO hillseok(山海经) 我按你的改成 string CommandText = "select * from tzhtable where age<@myage"; OracleConnection myConnection = new OracleConnection(ConnectionString); myConnection.Open(); OracleCommand myCommand = new OracleCommand (CommandText, myConnection); myCommand.Parameters.Add("@myage",OracleType.Int16); myCommand.Parameters["@myage"].Value=13; OracleDataReader myreader=myCommand.ExecuteReader(CommandBehavior.CloseConnection);还是不行。出同样的错ORA-01036: 非法的变量名/编号 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OracleClient.OracleException: ORA-01036: 非法的变量名/编号 Source Error: Line 125:myCommand.Parameters.Add("@myage",OracleType.Int16).Value=13; Line 126: Line 127: OracleDataReader myreader=myCommand.ExecuteReader(CommandBehavior.CloseConnection); Line 128: DataGrid2.DataSource=myreader; Line 129: DataGrid2.DataBind ();
myCommand.Parameters["@age"].value=参数值;
myCommand.Parameters.Add("@myage",OracleType.Int16).Value=13;
还是不行。
TO hillseok(山海经)
我按你的改成
string CommandText = "select * from tzhtable where age<@myage";
OracleConnection myConnection = new OracleConnection(ConnectionString);
myConnection.Open();
OracleCommand myCommand = new OracleCommand (CommandText, myConnection);
myCommand.Parameters.Add("@myage",OracleType.Int16);
myCommand.Parameters["@myage"].Value=13;
OracleDataReader myreader=myCommand.ExecuteReader(CommandBehavior.CloseConnection);还是不行。出同样的错ORA-01036: 非法的变量名/编号
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OracleClient.OracleException: ORA-01036: 非法的变量名/编号 Source Error:
Line 125:myCommand.Parameters.Add("@myage",OracleType.Int16).Value=13;
Line 126:
Line 127: OracleDataReader myreader=myCommand.ExecuteReader(CommandBehavior.CloseConnection);
Line 128: DataGrid2.DataSource=myreader;
Line 129: DataGrid2.DataBind ();
呵呵。enjoy