Community discussion forum

Problem with Oracle Parameter - not getting whole value of parameter

  • 6 months ago

    Hello, I have come accros this problem, altough I have been using this code before

    I have an oracle command with 1 parameter

    string cmd = " Select value from Database where id = :p1";

     OracleCommand command1 = new OracleCommand ( cmd, connection); OracleParameter p1= new OracleParameter ( "p1", OracleType.Varchar, 8);

     p1.Direction = ParameterDirection.InputOutput; OracleDataReader rdr = null;

    try { connection.Open();

     command.Parameters.Clear();

     command.Parameters.Add(p1);

     p1.Value = id_1;

    command.ExecuteNonQuery();

     rdr = command .ExecuteReader();

     ......

     

    the problem I get is in this line p1.Value=id_1;

    id_1 is a string of max 8 characters,

    and in p1.Value I get just the 1character

     any idea why?

     thanks Probi

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).