无法从System.Data.SqlDbType转换为System.Data.DbType

时间:2016-03-14 07:36:29

标签: c# sql sql-server-2008-r2 commandparameter sqldbtype

DbCommand retcommmand;



var attachmentDetails = this.ConvertToDatatable<CurfewAttachmentDetails>(curfewRequestForSave.Attachment);
            List<CommandParameter> SqlparamUpdate = new List<CommandParameter>();
            // SqlparamUpdate.Add(new CommandParameter("@PI_CurfewRelaxationId", curfewRequestForSave.CurfewRelaxationId, ParameterDirection.Input, DbType.Int64));
            SqlparamUpdate.Add(new CommandParameter("@PI_CurfewRelaxationId", curfewRequestForSave.CurfewRelaxationId, ParameterDirection.Input, DbType.Int64));
            SqlparamUpdate.Add(new CommandParameter("@PI_CurfewRelaxationRequestId", "TODO Code For WorkFlow", ParameterDirection.Input, DbType.String));
            SqlparamUpdate.Add(new CommandParameter("@PI_CurfewRequestCode", String.Empty, ParameterDirection.Input, DbType.String));
            SqlparamUpdate.Add(new CommandParameter("@PI_StaffSeqId", curfewRequestForSave.StaffSeqId, ParameterDirection.Input, DbType.Int64));
            SqlparamUpdate.Add(new CommandParameter("@PI_RequestCategoryId", curfewRequestForSave.RequestCategoryId, ParameterDirection.Input, DbType.Int32));
            SqlparamUpdate.Add(new CommandParameter("@PI_RequestTypeId", curfewRequestForSave.RequestTypeId, ParameterDirection.Input, DbType.Int32));
            SqlparamUpdate.Add(new CommandParameter("@PI_Reason", curfewRequestForSave.Reason, ParameterDirection.Input, DbType.String));
            SqlparamUpdate.Add(new CommandParameter("@PI_PermissionRequiredFrom", curfewRequestForSave.PermissionRequiredFrom, ParameterDirection.Input, DbType.DateTime));
            SqlparamUpdate.Add(new CommandParameter("@PI_PermissionRequiredTill", curfewRequestForSave.PermissionRequiredTill, ParameterDirection.Input, DbType.DateTime));
            SqlparamUpdate.Add(new CommandParameter("@PI_RelationshipId", curfewRequestForSave.RelationshipId, ParameterDirection.Input, DbType.Int32));
            SqlparamUpdate.Add(new CommandParameter("@PI_Spouse_Blood_Name", curfewRequestForSave.Spouse_Blood_Name, ParameterDirection.Input, DbType.String));
            SqlparamUpdate.Add(new CommandParameter("@PI_ReturnDate", curfewRequestForSave.ReturnDate, ParameterDirection.Input, DbType.DateTime));
            SqlparamUpdate.Add(new CommandParameter("@PI_ShiftTimmingsFrom", curfewRequestForSave.ShiftTimmingsFrom, ParameterDirection.Input, DbType.DateTime));
            SqlparamUpdate.Add(new CommandParameter("@PI_ShiftTimmingsTo", curfewRequestForSave.ShiftTimmingsTo, ParameterDirection.Input, DbType.DateTime));
            SqlparamUpdate.Add(new CommandParameter("@PI_CreatedBy", curfewRequestForSave.StaffSeqId, ParameterDirection.Input, DbType.Int64));
            SqlparamUpdate.Add(new CommandParameter("@PI_UpdatedBy", curfewRequestForSave.StaffSeqId, ParameterDirection.Input, DbType.Int64));
            SqlparamUpdate.Add(new CommandParameter("@PI_CurfewRquestAttchMntDetails", attachmentDetails, ParameterDirection.Input,SqlDbType.Structured));
            SqlparamUpdate.Add(new CommandParameter("@PO_MESSAGE", "", ParameterDirection.Output, DbType.String, 500));
            SqlparamUpdate.Add(new CommandParameter("@PO_RETURN_CODE", 0, ParameterDirection.Output, DbType.Int32));

            retcommmand = _sqldbframework.ExecuteSPNonQueryParm("QAG_GEMS_CURFEW_REQUEST_SAVE_DETAILS_PROC", SqlparamUpdate);

我应该使用CommandParameter,因为我正在使用其他团队定义的方法插入到数据库中我无法在此方案中更改为SQLCommandParameter如何传递表值参数

我收到了这个

  

错误无法从System.Data.SqlDbType转换为System.Data.DbType

0 个答案:

没有答案