locked
problem with table.select() RRS feed

  • Question

  • Hi,

    I have this code

    DataRow[] rows = table1.Select("Parent.name ="+ pname);

    where prname is a name entered by the user in a console. BUt this doesn't work. I suppose I should write prname on different way.

    Can anybody help me please?

    Thanks




    • Edited by pet06 Monday, March 31, 2014 2:42 AM
    Monday, March 31, 2014 2:41 AM

Answers

  • Hi,

    Have you tried putting single quotes, assuming Parent.name is a varchar?

    DataRow[] rows = table1.Select("Parent.name ='" + pname + "'");

    Hope this helps.
    ~ J.

    • Marked as answer by pet06 Monday, March 31, 2014 4:18 PM
    Monday, March 31, 2014 3:10 AM

All replies

  • Hi,

    Have you tried putting single quotes, assuming Parent.name is a varchar?

    DataRow[] rows = table1.Select("Parent.name ='" + pname + "'");

    Hope this helps.
    ~ J.

    • Marked as answer by pet06 Monday, March 31, 2014 4:18 PM
    Monday, March 31, 2014 3:10 AM
  • Please post to .Net forum.

    Regards, RSingh

    Monday, March 31, 2014 3:57 AM
    Answerer
  • thanks
    Monday, March 31, 2014 4:18 PM