Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 money parameters

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-15 : 09:23:58
sergio writes "I made a stored procedure to insert values into a table which has "money" fields. When I executed the command on my visual basic code, I got the message:
"Implicit conversion from date type datetime to money is not allowed. Use the convert function to run the query."
I set the parameter value to "200.00", for example.
I tried everything I know to solve this problem, including to pass the value as nvarchar parameter and converting it to money inside the stored procedure. Help me, please!

Stored procedure:

CREATE PROCEDURE [usp_ins_table1]
(@Sacado [nvarchar](50),
@DataEmissao [datetime],
@DataCredito [datetime],
@VDoc [money],
@Info [nvarchar](250),
@BC [nvarchar](1),
@Status [nvarchar](2))

AS
BEGIN
DECLARE @NEXTDUP INT
SELECT @NEXTDUP=MAX(NDUP) + 1 FROM TABLE1
INSERT INTO [TABLE1]
([DUP],
[Sacado],
[DataEmissao],
[DataCredito],
[VDoc],
[Info],
[BC],
[Status])
VALUES
(@NEXTDUP,
@Sacado,
@DataEmissao,
@DataCredito,
@VDoc,
@Info,
@BC,
@Status)
return @NEXTDUP
END

The visual basic code looks like this (reduced):

Dim cmd1 as new adodb.command
With cmd1
.ActiveConnection = cn1
.CommandText = "usp_ins_table1"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("NDup", adInteger, adParamReturnValue)
.Parameters.Append .CreateParameter("@sacado", adVarWChar, adParamInput, 50)
.Parameters.Append .CreateParameter("@dataemissao", adDate, adParamInput)
.Parameters.Append .CreateParameter("@datacredito", adDate, adParamInput)
.Parameters.Append .CreateParameter("@vdoc", adCurrency, adParamInput)
.Parameters.Append .CreateParameter("@info", adVarWChar, adParamInput, 250)
.Parameters.Append .CreateParameter("@status", adVarWChar, adParamInput, 2)
.Parameters.Append .CreateParameter("@bc", adVarWChar, adParamInput, 1)

For c = 1 To NDUPS
.Parameters("@sacado") = Trim(Txt4(1))
.Parameters("@dataemissao") = FG2.TextMatrix(5,c)
.Parameters("@datacredito") = FG2.TextMatrix(6, c)
.Parameters("@datareg") = FG2.TextMatrix(4, c)
.Parameters("@vdoc") = FG2.TextMatrix(7, c)
.Parameters("@info") = FG2.TextMatrix(8, c)
.Parameters("@status") = "GC"
.Execute RA, , adExecuteNoRecords
DUPS(c) = .Parameters("NDup")
Next c
End With
Set cmd1 = Nothing
cn1.CommitTrans"
   

- Advertisement -