Search code examples
asp.netoraclewhere-clausesqldatasourceselectcommand

A WHERE statement in my SqlDataSource causes invalid character exception (ORA-00911), why?


I'm using Oracle developer tools and my generated select command is:

SelectCommand = "SELECT "FIRSTNAME" FROM "USERS" WHERE ("USERNAME" = ?)">`

Then I removed all " and replaced them with a single quote: '.

Then I get that error (mentioned in the title).

Any suggestions how I can make it work?


Solution

  • You should be using like this

    select firstname from users where username='%?'

    Just replace the value in the where condition with your live values. Note down the syntax of SQL