I am doing an insert on an ASP page, and not able to insert a value in to a column with a datatype of 'Money'.
I have tried several different ways of doing it, but get the same result with all.
Here is the ASP part of geting the variable value:
ResCost = request("Reservation_Cost"
'** I figure thatconverting it to a number first is best**
dim insResCost
insResCost = cdbl(ResCost)
Here is the SQL statement:
sql= "SET NOCOUNT ON " & _
"INSERT INTO tblCCReserve(Event,BillName,ChargeAmount,CreditCard,CreditCardName," & _
"CreditCardCompany,CreditCardNum,CreditCardExpMo,CreditCardExpYear,ReservationDate," & _
"eCC) VALUES('"&txtEvent&"','"&CCname&"','CONVERT(money,"&insResCost&"','"&btnCard&"','"&CCname&"'," &_
"'"&CCcompany&"','"&EncryptAcctNo&"','"&CCExpMo&"','"&CCExpYear&"','"&ResDate&"','1')" & _
" SELECT @@IDENTITY as RecNum"
And it always returns:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Disallowed implicit conversion from data type varchar to data type money, table 'WCACredit.dbo.tblCCReserve', column 'ChargeAmount'. Use the CONVERT function to run this query.
What am I doing wrong?
Thanks for any
I have tried several different ways of doing it, but get the same result with all.
Here is the ASP part of geting the variable value:
ResCost = request("Reservation_Cost"
'** I figure thatconverting it to a number first is best**
dim insResCost
insResCost = cdbl(ResCost)
Here is the SQL statement:
sql= "SET NOCOUNT ON " & _
"INSERT INTO tblCCReserve(Event,BillName,ChargeAmount,CreditCard,CreditCardName," & _
"CreditCardCompany,CreditCardNum,CreditCardExpMo,CreditCardExpYear,ReservationDate," & _
"eCC) VALUES('"&txtEvent&"','"&CCname&"','CONVERT(money,"&insResCost&"','"&btnCard&"','"&CCname&"'," &_
"'"&CCcompany&"','"&EncryptAcctNo&"','"&CCExpMo&"','"&CCExpYear&"','"&ResDate&"','1')" & _
" SELECT @@IDENTITY as RecNum"
And it always returns:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Disallowed implicit conversion from data type varchar to data type money, table 'WCACredit.dbo.tblCCReserve', column 'ChargeAmount'. Use the CONVERT function to run this query.
What am I doing wrong?
Thanks for any