I'm having money problems...
Greetings all,
I'm new to all this, lots of mainframe, but I have to make a prototype of a legacy system I worked on and I have a bunch of WROX books to go on.
Using ASP to present the info to the user I have an INPUT field that will be used to display and update a price, defined as a decimal(7,2) in a SQL Server 2000 database.
When I create the parameter to pass to the stored procedure, I have used
curPrice = CDBL(TRIM(request("txtPrice"))) and then create the parameter to pass to the stored procedure using the variable:
cmdParts.Parameters.Append cmdParts.CreateParameter ("@PRICE", addecimal, adParamInput, , curPrice)
I also tried it like this:
cmdParts.Parameters.Append cmdParts.CreateParameter ("@PRICE", addecimal, adParamInput, , CDbl(Trim(request("txtPrice"))))
I build the rest of the parameters and call the stored procedure.
The stored procedure has the parameter defined as
REATE PROCEDURE ADD_ITEM_DETAIL
(@ITEMSEQ Int
,@ITEMDETAILDESC varchar(50)
,@PRICE decimal(7,2)
,@REQUIRED char(01)
,@ACTIVE char(01)
)
and the field is defined in the database as a decimal(7,2)
And I get this....
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/CE/Maintenance/Plans/UpdatePlanCodeInfo.asp, line 93
If removed all references to the 'price' and I can add rows without a problem (price is nullable)
So... how do you get a price (7.25) from the HTML to the stored procedure and get it updated? Somewhere on the way it appears I am encountering a data type conversion problem of some kind.
I've tried to redefine the field as Money vs. decimal.
Regards.
Mr. Federalist
|