ORA-01036: illegal variable name/number parameter in ASP.Net app

My Oracle chops are way outdated, and, being a fan of business objects and/or a genuine Data Access Layer, I’m not used to working with typed datasets in asp.net.  So when I got the above error I was pretty stumped, and I started using some obscene anti-Oracle phrases to name a few test variables to figure out wtf was going on.

Eventually I figured out that it’s not a good idea to just enter parameters into a Select method via the Properties window, even though Visual Studio will cheerfully let you do that.  If you don’t have the parameter referenced in the actual SQL of the select method, you’re gonna get the above message when you try using it.  So…

In your Select method’s SQL, be sure to add “WHERE ID = :ID” and Visual Studio should pick up on that and make a parameter for you.  Too bad it doesn’t work the other way around.

When I was trying to find info on this error I found lots of talk about update parameters and other causes, but didn’t see anything related to this particular circumstance.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: