• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

The precision is invalid

Hello,

I'm attempting to insert a record into a database, but I'm getting the following message -

Microsoft OLE DB Provider for SQL Server error '80004005'
The precision is invalid.
/includes/retainersurveyinput.asp, line 46

My database is as below --

CREATE TABLE [dbo].[RetainerSurvey](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Date] [datetime] NOT NULL,
	[MemberID] [int] NOT NULL,
	[Locality] [int] NOT NULL,
	[RetainerValue] [decimal](10, 2) NOT NULL,
	[FeeCommission] [decimal](10, 2) NOT NULL,
	[TotalRetainer] [decimal](10, 2) NOT NULL,
	[ReviewDate] [datetime] NOT NULL,
	[Comments] [nvarchar](max) NULL,
	[Live] [char](1) NOT NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[RetainerSurvey] ADD  DEFAULT (getdate()) FOR [Date]
GO

ALTER TABLE [dbo].[RetainerSurvey] ADD  DEFAULT ('0.00') FOR [RetainerValue]
GO

ALTER TABLE [dbo].[RetainerSurvey] ADD  DEFAULT ('0.00') FOR [FeeCommission]
GO

ALTER TABLE [dbo].[RetainerSurvey] ADD  DEFAULT ('0.00') FOR [TotalRetainer]
GO

ALTER TABLE [dbo].[RetainerSurvey] ADD  DEFAULT (getdate()) FOR [ReviewDate]
GO

ALTER TABLE [dbo].[RetainerSurvey] ADD  DEFAULT ('Y') FOR [Live]
GO

Open in new window


My stored Procedure insert is -

<% If Request("Retainerinput") = "yes" AND Session("UID") <> "" AND Request("Locality") <> "" AND Request("RetainerValue") <> "" AND Request("FeeCommission") AND Request("TotalRetainer") <> "" AND Request("ReviewDate") <> "" then

Dim CMDRetainerInout__MemberID
CMDRetainerInout__MemberID = "0"
if(Session("UID") <> "") then CMDRetainerInout__MemberID = Session("UID")

Dim CMDRetainerInout__Locality
CMDRetainerInout__Locality = "0"
if(Request("Locality") <> "") then CMDRetainerInout__Locality = Request("Locality")

Dim CMDRetainerInout__RetainerValue
CMDRetainerInout__RetainerValue = ""
if(Request("RetainerValue") <> "") then CMDRetainerInout__RetainerValue = Request("RetainerValue")

Dim CMDRetainerInout__FeeCommission
CMDRetainerInout__FeeCommission = ""
if(Request("FeeCommission") <> "") then CMDRetainerInout__FeeCommission = Request("FeeCommission")

Dim CMDRetainerInout__TotalRetainer
CMDRetainerInout__TotalRetainer = ""
if(Request("TotalRetainer") <> "") then CMDRetainerInout__TotalRetainer = Request("TotalRetainer")

Dim CMDRetainerInout__ReviewDate
CMDRetainerInout__ReviewDate = ""
if(Request("ReviewDate") <> "") then CMDRetainerInout__ReviewDate = Request("ReviewDate")

Dim CMDRetainerInout__Comments
CMDRetainerInout__Comments = ""
if(Request("Comments") <> "") then CMDRetainerInout__Comments = Left(Server.HTMLEncode(Request("Comments")),4500)


set CMDRetainerInout = Server.CreateObject("ADODB.Command")
CMDRetainerInout.ActiveConnection = MM_Connection_STRING
CMDRetainerInout.CommandText = "dbo.MemberRetainerSurveyInput"
CMDRetainerInout.CommandType = 4
CMDRetainerInout.CommandTimeout = 0
CMDRetainerInout.Prepared = true
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@RETURN_VALUE", 3, 4)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@MemberID", 3, 1,4,CMDRetainerInout__MemberID)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@Locality", 3, 1,4,CMDRetainerInout__Locality)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@RetainerValue", 14, 1,-1,CMDRetainerInout__RetainerValue)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@FeeCommission", 14, 1,-1,CMDRetainerInout__FeeCommission)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@TotalRetainer", 14, 1,-1,CMDRetainerInout__TotalRetainer)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@ReviewDate", 200, 1,50,CMDRetainerInout__ReviewDate)
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@Comments", 200, 1,5000,CMDRetainerInout__Comments)
CMDRetainerInout.Execute()

Response.Redirect "retainersurveyresults.asp?l=" & Request("Locality")
 
End If
%>

Open in new window


Please advise - where my precision is invalid..

Thanks
0
garethtnash
Asked:
garethtnash
  • 2
  • 2
1 Solution
 
X_layerCommented:
80004005 is generic error for Access Denied. Do you have permissions on SQL server?
0
 
garethtnashAuthor Commented:
Yes
0
 
X_layerCommented:
Here is something on this subject. And also here.
0
 
pateljituCommented:
Please try these changes:

ASP CODE (In which have changed the TYPE from adDecimal to adDouble and it will work):
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@RetainerValue", 5, 1, -1,cdbl(CMDRetainerInout__RetainerValue))
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@FeeCommission", 5, 1, -1,cdbl(CMDRetainerInout__FeeCommission))
CMDRetainerInout.Parameters.Append CMDRetainerInout.CreateParameter("@TotalRetainer", 5, 1, -1,cdbl(CMDRetainerInout__TotalRetainer))

and in you STORE PROCEDURE have your input parameter as:
@RetainerValue decimal(10, 2),
@FeeCommission decimal(10, 2),
@TotalRetainer decimal(10, 2),
0
 
garethtnashAuthor Commented:
Thank you Pateljitu
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now