Posts

Showing posts from July, 2008

Troubleshooting the "ORA-01036: illegal variable name/number" Error When Calling an Oracle Stored Procedure from .NET

Yesterday I had written some code in C# to call a stored procedure in an Oracle database, and when I began testing this code today, I was surprised to get the following error whenever the code would attempt to execute the OracleCommand: ORA-01036: illegal variable name/number I was scratching my head. Why wasn't this working? I've done this before! From previous experience, I knew that the names of the procedure parameters must match exactly when you add them to the OracleCommand object . In other words, if your stored procedure is expecting two parameters, named email and phonenumber , your code should look something like this: cmd.Parameters.Add("email", OracleType.VarChar); cmd.Parameters.Add("phonenumber", OracleType.VarChar); cmd.Parameters["email"].Value = psEmail; cmd.Parameters["phonenumber"].Value = psPhone; I checked the parameter names and I was already using the correct ones. What else was I missing? Then it dawned on me

Why The MaxLength Property Isn't Working For Your ASP.NET TextBox

So, you've written a web page in ASP.NET, placed an asp:TextBox control on the page, and set it's MaxLength property -- but when you run the site and go to that page, you find that you can type in as much text as you want. What's going on here? The answer: you set the TextMode property to "MultiLine". Here's what's happening: when ASP.NET renders a page to the browser, it converts server-side controls to their HTML equivalents. In the case of an asp:TextBox control with the TextMode property set to "MultiLine", the control is rendered not as an &ltinput> control, but rather a <textarea> control. And the HTML specification for the &ltltextarea> control does not include a maxlength property. So it all makes sense, though it would be nice if the compiler would catch this and generate an error -- otherwise, this could sneak by unnoticed and cause problems with your site later.

When AJAX and Forms Authentication Don't Play Nice

I've been doing some work with AJAX in ASP.NET lately, and one of the things I've run into is the "'Sys' is undefined" error. Originally, I was getting this error in my server-side code. You can view my solution in this post . However, once that was resolved, I started getting the same error (or, sometimes, the slightly different "Sys is not defined" -- I think I got this one in FireFox) in my client-side code. The error was occuring on the login page of the site, and the site uses Forms Authentication. It was also intermittent -- everything would be working fine, but then after accessing the page a few times I'd get the error. A quick fix I discovered was to change the authorization info in the web.config file to allow all users, run the app in development mode, then close the browser and change the web.config file back to only allow authenticated users. This would stave off the error for a little while, but it would always return. I fin