I am having the error below:
- Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
-
- Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
-
- Exception Details: System.Data.SqlClient.SqlException: Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
this is when trying to insert values to my table. Below is my table structure:
- CREATE TABLE [dbo].[TaxInvoiceDetails_Book](
- [ID] [int] IDENTITY(1,1) NOT NULL,
- [TransactionDate] [date] NULL,
- [TransactionNo] [nvarchar](50) NULL,
- [TaxInvoiceNumber] [nvarchar](50) NULL,
- [CustomerNo] [nvarchar](50) NOT NULL,
- [CustomerName] [nvarchar](50) NULL,
- [MotorCINo] [int] NULL,
- [ProductType] [nvarchar](50) NULL,
- [OrigNetPremium] [decimal](18, 2) NULL,
- [OrigVAT] [decimal](18, 2) NULL,
- [OrigRegistryFee] [decimal](18, 2) NULL,
- [TotalPremium] [decimal](18, 2) NULL,
- [AgentGrossCommission] [decimal](18, 2) NULL,
- [AgentTax] [decimal](18, 2) NULL,
- [AgentNetCommission] [decimal](18, 2) NULL,
- [ConvertedNetPremium] [decimal](18, 2) NULL,
- [ConvertedVAT] [decimal](18, 2) NULL,
- [ConvertedRegistryFee] [decimal](18, 2) NULL,
- [ConvertedTotalPremium] [decimal](18, 2) NULL,
- [ControlNumber] [nvarchar](50) NULL,
- [InsuranceType] [nvarchar](50) NULL,
- [InsuranceOption] [nvarchar](50) NULL,
- [NCD] [char](10) NULL,
- [SumInsured] [decimal](18, 2) NULL,
- [CashierID] [nvarchar](50) NULL,
- [BranchID] [nchar](10) NULL,
- [AgentID] [nvarchar](50) NULL,
- CONSTRAINT [PK_TaxInvoiceDetails_Book] PRIMARY KEY CLUSTERED
- (
- [ID] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY]
Below is my Stored Proc
- ALTER PROCEDURE [dbo].[spInsertToTaxInvoiceDetails_Book]
-
- (
-
- @TransactionDate date,
- @TransactionNo nvarchar(50),
- @TaxInvoiceNumber nvarchar(50),
- @CustomerNo nvarchar(50),
- @CustomerName nvarchar(50),
- @MotorCINo int,
- @ProductType nvarchar(50),
- @OrigNetPremium decimal(18,2),
- @OrigVAT decimal(18,2),
- @OrigRegistryFee decimal(18,2),
- @TotalPremium decimal(18,2),
- @AgentGrossCommission decimal(18,2),
- @AgentTax decimal(18,2),
- @AgentNetCommission decimal(18,2),
- @ConvertedNetPremium decimal(18,2),
- @ConvertedVAT decimal(18,2),
- @ConvertedRegistryFee decimal(18,2),
- @ConvertedTotalPremium decimal(18,2),
- @ControlNumber nvarchar(50),
- @InsuranceType nvarchar(50),
- @InsuranceOption nvarchar(50),
- @NCD char(10),
- @SumInsured decimal(18,2),
- @CashierID nvarchar(50),
- @BranchID nchar(10),
- @AgentID nvarchar(50))
- AS
- BEGIN
-
-
- SET NOCOUNT ON;
-
-
- INSERT INTO [dbo].[TaxInvoiceDetails_Book]
- ([TransactionDate]
- ,[TransactionNo]
- ,[TaxInvoiceNumber]
- ,[CustomerNo]
- ,[CustomerName]
- ,[MotorCINo]
- ,[ProductType]
- ,[OrigNetPremium]
- ,[OrigVAT]
- ,[OrigRegistryFee]
- ,[TotalPremium]
- ,[AgentGrossCommission]
- ,[AgentTax]
- ,[AgentNetCommission]
- ,[ConvertedNetPremium]
- ,[ConvertedVAT]
- ,[ConvertedRegistryFee]
- ,[ConvertedTotalPremium]
- ,[ControlNumber]
- ,[InsuranceType]
- ,[InsuranceOption]
- ,[NCD]
- ,[SumInsured]
- ,[CashierID]
- ,[BranchID]
- ,[AgentID])
- VALUES
- (@TransactionDate,
- @TransactionNo,
- @TaxInvoiceNumber,
- @CustomerNo,
- @CustomerName,
- @MotorCINo,
- @ProductType,
- @OrigNetPremium,
- @OrigVAT,
- @OrigRegistryFee,
- @TotalPremium,
- @AgentGrossCommission,
- @AgentTax,
- @AgentNetCommission,
- @ConvertedNetPremium,
- @ConvertedVAT,
- @ConvertedRegistryFee,
- @ConvertedTotalPremium,
- @ControlNumber,
- @InsuranceType,
- @InsuranceOption,
- @NCD,
- @SumInsured,
- @CashierID,
- @BranchID,
- @AgentID)
Thank in advance for any assistance.