Classic ASP (Data Type Issues)

Posted by on March 29, 2011

It has been a long time since I have spent any time working with some classic ASP code.  After spending so many years focusing more on Microsoft’s .Net platform, I see why people make the switch.  My task was to update some old inline SQL calls (yeah, I know) to stored procedures or parameterized queries.  The list of calls was fairly small, since most of the calls were already stored procedures.  Things should have been nice and simple.  Create the stored procedures, add some command objects with parameters and we are good to go.  Unfortunately, there were a few hiccups, mostly around data types.

I ran into two issues that really through me for a loop.  The first was while trying to pass a bit parameter.  I set my parameter type to adBoolean, which I thought was right, but every time I would test the call it would not update my table.  Before narrowing this down to the bit field, I tried transactions, GO statements, anything I could think of with no success.  I then removed this parameter and was successful.  I tried many different settings to get the adBoolean to work correctly, and it never did.  The worst part was that it didn’t even give me an error, it just acted like everything was ok.  I ended up using two different stored procedures around the bit field.  Not an ideal solution, but it works on this type of application. 

Next, I ran into an issue with the Money datatype.  Setting my parameter to adCurrency gave me the exact same results as the previous parameter.  No error, and no update.  For this small query, I actually just did a parameterized query instead of the stored procedure. 

If anyone has any ideas on why this wasn’t working, please post them in the comments.  The stored procedures are straight forward with inputs like  @myMoney Money   or    @myBit bit. 

It is not often I deal with classic ASP, and I think I know why now.  In most cases it would not have been that bad, but in this case, the ability to debug and test were very limited, adding to the complexity of the problem.  The good news is that the changes are done and the code is a bit safer now.

Comments

Comments are closed.