0

こんにちは私はifelseステートメントを実行しようとしています:

@{
if(isset(Request["approve"])) { 
        var sql6 = "UPDATE Medical SET NurseDecision = 1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appMedical = new[]{myCDSID, medicalData.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql6,appMedical);

        var sql7 = "UPDATE PermitApp SET NurseDecision = 1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appPermitApp =new[]{myCDSID, reqPermit.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql7,appPermitApp);

    } elseif(isset(Request["reject"])){

        var sql8 = "UPDATE Medical SET NurseDecision = -1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appMedical1 = new[]{myCDSID, medicalData.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql8,appMedical1);

        var sql9 = "UPDATE PermitApp SET NurseDecision = -1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appPermitApp1 =new[]{myCDSID, reqPermit.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql9,appPermitApp1);
        }
}

次のような1つのフォームの2つの送信ボタンの場合:

<form>
<input class="button" type="submit" style="margin:10px auto;" name="reject" value="Reject" />
<input class="button" type="submit" style="margin:10px auto; margin-left:400px;" name="approve" value="Approve" />
</form>

ただし、これはエラーです。

CS1026: ; expected on this line>> } elseif(isset(Request["reject"])){

誰かが私の間違いを私に指摘できますか?ありがとう

4

1 に答える 1

0

elseifはキーワードでissetはなく、c#では使用できません。ここにあなたを動かすためのいくつかのコードがあります。

@{
    if(!string.IsNullOrEmpty(Request["approve"])) { 
        var sql6 = "UPDATE Medical SET NurseDecision = 1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appMedical = new[]{myCDSID, medicalData.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql6,appMedical);

        var sql7 = "UPDATE PermitApp SET NurseDecision = 1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appPermitApp =new[]{myCDSID, reqPermit.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql7,appPermitApp);

    } else if(!string.IsNullOrEmpty(Request["reject"])){

        var sql8 = "UPDATE Medical SET NurseDecision = -1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appMedical1 = new[]{myCDSID, medicalData.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql8,appMedical1);

        var sql9 = "UPDATE PermitApp SET NurseDecision = -1, NurseCDSID = @0, NurseDate = GetDate() WHERE MedId = @1 AND AppId = @2 AND CDSID = @3";
        var appPermitApp1 =new[]{myCDSID, reqPermit.MedId, permitAppAppId, employeeCDSID};
        db.Execute(sql9,appPermitApp1); 
    }
}
于 2012-04-24T04:08:58.570 に答える