1

言及されたエラーへのリンクをたくさん試しましたが、解決策がありません。

Compiler Error Message: CS0023: Operator '.' cannot be applied to operand of type 'void'

Source Error:


Line 56: if (iscomplete == false)
Line 57: {
Line 58: var qryPartnerJobs = at.uspGetPartnerTrade(Convert.ToInt32(Session["user"]), assigned, servid, isapply).ToList();
Line 59: gvPartnerJob.DataSource = qryPartnerJobs;
Line 60: gvPartnerJob.DataBind();

Source File: 

> Blockquote

\alltradepartners.com\wwwroot\test\partner\jobs_view.aspx.cs Line: 58

SPコード

ALTER PROC [dbo].[uspGetPartnerTrade] @UserID BIGINT, @IsAssigned BIT = NULL, @ServiceID INT = NULL, @IsPartnerApply BIT = NULL
AS
BEGIN
    SET NOCOUNT ON
    SET FMTONLY OFF
    DECLARE @TradeList XML
    CREATE TABLE #tblTradeList (Trade VARCHAR(255))
    DECLARE @IsUserAdmin BIT = 0, @SQL NVARCHAR(MAX), @WhereClause NVARCHAR(MAX) = ''
    DECLARE @ParmDefinition NVARCHAR(500)

    SELECT @IsUserAdmin = 1 FROM users U INNER JOIN [role] R ON U.RoleID = R.RoleID 
        WHERE R.RoleName = 'admin' AND U.IsActive = 1 AND U.UserID = @UserID

    SET @TradeList = (SELECT CAST('<A>'+ REPLACE([td].Trades,', ','</A><A>')+ '</A>' AS XML)
    FROM tradesman_details [td] WHERE [td].UserID = @UserID)

    INSERT INTO #tblTradeList (Trade)
        SELECT t.value('.', 'VARCHAR(255)') AS inVal FROM @TradeList.nodes('/A') AS x(t) 

    IF @IsUserAdmin = 1 
    BEGIN
        IF @IsAssigned IS NOT NULL
        BEGIN
            SET @WhereClause = ' AND [t2].IsAssigned = @IsAssigned '
        END
        SET @Sql = 'SELECT [t0].[JobID] AS [JobID], [t2].[IsAssigned] AS [IsAssigned], [t0].[JobUniqueID], [t1].[FirstName], 
        [t1].[LastName], [t0].[IsApproved], [t0].[IsActive], [t0].[IsQuoted], [t0].[IsAssigned] AS [Column1], 
        [t0].[ApprovalDate], CAST([t0].[Description] AS NVARCHAR(MAX)) AS [Description], [t3].[ServiceName], [t4].[ServiceTypeName]
        FROM [dbo].[jobs] AS [t0]
        INNER JOIN [dbo].[users] AS [t1] ON [t0].[CustomerUserID] = [t1].[UserID]
        LEFT OUTER JOIN [dbo].[job_assigned] AS [t2] ON [t0].[JobID] = [t2].[JobID]
        INNER JOIN [dbo].[services] AS [t3] ON [t3].[ServiceID] = [t0].[ServiceID]
        INNER JOIN [dbo].[service_type] AS [t4] ON [t4].[ServiceTypeID] = [t0].[ServiceTypeID]
        WHERE 
        (((
        SELECT COUNT(*) FROM [dbo].[job_quotes] AS [t5]
        WHERE [t5].[JobID] = [t0].[JobID] )) <= 3) AND 
        (NOT ([t0].[IsComplete] = 1)) 
        AND [t0].ServiceID = ISNULL(@ServiceID, [t0].ServiceID) 
        AND [t3].ServiceName = [t3].ServiceName
        AND [t1].PostCode = [t1].PostCode
        AND [t0].IsActive = 1 AND [t0].IsApproved = 1'

        SET @ParmDefinition = N'@IsAssigned BIT, @ServiceID INT'

        SET @Sql = @Sql + @WhereClause

        EXECUTE sp_executesql @Sql, @ParmDefinition, @IsAssigned = @IsAssigned, @ServiceID = @ServiceID


    END
    ELSE
    BEGIN

        IF @IsAssigned IS NOT NULL
        BEGIN
            SET @WhereClause = ' AND [t2].IsAssigned = @IsAssigned '
        END

        IF @IsPartnerApply IS NOT NULL
        BEGIN
            SET @WhereClause = @WhereClause + ' AND [t6].[IsPartnerApply] = @IsPartnerApply '
        END

        SET @Sql = 'SELECT DISTINCT [t0].[JobID] AS [JobID], [t2].[IsAssigned] AS [IsAssigned], [t0].[JobUniqueID], [t1].[FirstName], 
        [t1].[LastName], [t0].[IsApproved], [t0].[IsActive], [t0].[IsQuoted], [t0].[IsAssigned] AS [Column1], 
        [t0].[ApprovalDate], CAST([t0].[Description] AS NVARCHAR(MAX)) AS [Description], [t3].[ServiceName], [t4].[ServiceTypeName]
        FROM [dbo].[jobs] AS [t0]
        INNER JOIN [dbo].[users] AS [t1] ON [t0].[CustomerUserID] = [t1].[UserID]
        LEFT OUTER JOIN [dbo].[job_assigned] AS [t2] ON [t0].[JobID] = [t2].[JobID]
        LEFT OUTER JOIN [dbo].[job_quotes] AS [t6] ON [t0].[JobID] = [t6].[JobID] 
        INNER JOIN [dbo].[services] AS [t3] ON [t3].[ServiceID] = [t0].[ServiceID]
        INNER JOIN [dbo].[service_type] AS [t4] ON [t4].[ServiceTypeID] = [t0].[ServiceTypeID]
        WHERE 
        (((
        SELECT COUNT(*) FROM [dbo].[job_quotes] AS [t5]
        WHERE [t5].[JobID] = [t0].[JobID] )) <= 3) AND 
        (NOT ([t0].[IsComplete] = 1))
        AND [t0].ServiceID = ISNULL(@ServiceID, [t0].ServiceID)
        AND [t0].IsActive = 1 AND [t0].IsApproved = 1
        AND [t3].ServiceName IN (SELECT Trade collate SQL_Latin1_General_CP1_CI_AS FROM #tblTradeList  WHERE Trade <> '''')
        AND [t1].PostCode IN (SELECT PostCode FROM users WHERE UserID  = @UserID)'

        SET @ParmDefinition = N'@IsAssigned BIT, @ServiceID INT,  @IsPartnerApply BIT, @UserID BIGINT'

        SET @Sql = @Sql + @WhereClause

        EXECUTE sp_executesql @Sql, @ParmDefinition, @IsAssigned = @IsAssigned, @ServiceID = @ServiceID, @IsPartnerApply = @IsPartnerApply, @UserID = @UserID

    END
    DROP TABLE #tblTradeList
END
4

1 に答える 1

1

そのエラーuspGetPartnerTradeは、戻り値の型が であることを意味しますvoid。が参照するメソッドの宣言がないので、それ以上は言えませんat.uspGetPartnerTrade。ただし、リターン.ToList()があるものを呼び出すことはできません。void

于 2013-11-02T08:52:32.010 に答える