Error While saving data from C#.net DataTable to SQL DataTableHi Guys,
I have a error Table in the sql and in the front end i have datatable in which i save all the error occurs in the application and saves this datatable values to the DB table by passing the front end DataTable to sql dataTable. Its working good in testing environment but not working in Live server and DB and getting the following error.
"There are not enough fields in the Structured type. Structured types must have at least one field."
Below is the creation of DataTable in DB and Stored Procudure to save in the error Table from dataTable.
CREATE TYPE [dbo].[DataTableErrDetails] AS TABLE(
[ApplicationName] [varchar](300) NULL,
[ProcessInfo] [varchar](300) NULL,
[ExceptionDetail] [varchar](max) NULL,
[FunctionName] [varchar](300) NULL
CREATE Procedure [dbo].[USP_InsertErrorDetailsNew]
@ErrorDetails dbo.DataTableErrDetails READONLY
INSERT INTO tblAppErrorLog(ApplicationName, ProcessedOn, ProcessInfo,ExceptionDetail,StatusSeqId,FunctionName,UserID)
SELECT ApplicationName, GETDATE() AS ProcessedOn,
ProcessInfo,ExceptionDetail,0 AS StatusSeqId,FunctionName ,
NEWID() AS UserID FROM @ErrorDetails
Thanks & Regards,