When I execute the below query I get follow exception:
Cannot find either column “dbo” or the user-defined function or aggregate “dbo.GET_Vendor_Order_DeductionAmount”, or the name is ambiguous
My SQL:
string strinsert5 = "INSERT INTO VendorWallet(
VendorID,
Amount,
WalletTransactionTypeID,
Status,
DateAdded,
OrderID,
OrderDeductedAmount,
ClosingBalance
) values (
@VendorID,
@Amount,
@WalletTransactionTypeID,
@Status,
getdate(),
@OrderID,
dbo.[GET_Vendor_Order_DeductionAmount] (@VendorID, " + OperatorID + ",@Amount),
dbo.GET_Wallet_Amount(@VendorID)+@Amount)";
please help me.
Why is this all in a string like this? Why is everything parameterized EXCEPT OperatorID? There is a lot of code smell in the very short amount of code posted. However, you can make this work by simply using a select instead of a values list. I would urge you to properly parameterize everything instead of most of this though.
string strinsert5 = "INSERT INTO VendorWallet(
VendorID,
Amount,
WalletTransactionTypeID,
Status,
DateAdded,
OrderID,
OrderDeductedAmount,
ClosingBalance
)
SELECT
@VendorID,
@Amount,
@WalletTransactionTypeID,
@Status,
getdate(),
@OrderID,
dbo.[GET_Vendor_Order_DeductionAmount] (@VendorID, " + OperatorID + ",@Amount),
dbo.GET_Wallet_Amount(@VendorID)+@Amount";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.