2014-12-10 5 views
0

주어진 값 없음 :업데이트 할 때 오류가 발생했습니다. 오류 :이 오류를 해결하는 방법을 알아낼 수없는 하나 개 이상의 필수 매개 변수

Exception Details: System.Data.OleDb.OleDbException: No value given for one or 
more required parameters. 

나는 사용자의 정보를 업데이트 할 때마다 나는이 오류가 발생합니다. 나는 코드에서 빠진 것이 무엇인지 알아 내려고 해법을 찾고 있었다. 나는 이와 비슷한 질문을 발견했으나 어떤 것이 제거되어야하는지 잘 모르기 때문에 종류가 다릅니다.

<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/Geebiz.mdb" 
    DeleteCommand="DELETE FROM [tbl_Student] WHERE [Student_Num] = ?" 
    InsertCommand="INSERT INTO [tbl_Student] ([Student_Num], [Team_ID], [Team_Status], 
     [Student_University], [Student_UniCountry], [Student_FullName], [Student_PreferredName], 
     [Student_Email], [Student_Email2], [Student_Address1], [Student_Address2], 
     [Student_Address3], [Student_AddressCity], [Student_AddressCountry], 
     [Student_AddressPostcode], [Student_MobileCountryList], [Student_MobilePhone], 
     [Student_Facebook], [Student_Skype], [Student_Gender], [Student_CourseRep], 
     [Student_English], [Student_Broadband], [Student_CompAccess], [Recommender_Name], 
     [Recommender_Email], [Recommender_Phone], [Student_Status]) 
    VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" 

    SelectCommand="SELECT * FROM [tbl_Student] WHERE ([Student_Num] = ?)" 
    UpdateCommand="UPDATE [tbl_Student] SET [Team_ID] = ?, [Team_Status] = ?, 
    [Student_University] = ?, [Student_UniCountry] = ?, [Student_FullName] = ?, 
    [Student_PreferredName] = ?, [Student_Email] = ?, [Student_Email2] = ?, 
    [Student_Address1] = ?, [Student_Address2] = ?, [Student_Address3] = ?, 
    [Student_AddressCity] = ?, [Student_AddressCountry] = ?, [Student_AddressPostcode] = ?, 
    [Student_MobilePhoneCountryCode] = ?, [Student_MobileCountryList] = ?, [Student_Facebook] = 
    ?, [Student_Skype] = ?, [Student_Gender] = ?, [Student_CourseRep] = ?, [Student_English] = ?, 
    [Student_Broadband] = ?, [Student_CompAccess] = ?, [Recommender_Name] = ?, 
    [Recommender_Email] = ?, [Recommender_Phone] = ?, [Student_Status] = ? 
    WHERE [Student_Num] = ?"> 

    <SelectParameters> 
     <asp:ControlParameter ControlID="GridView1" Name="Student_Num" 
      PropertyName="SelectedValue" Type="Int32" /> 
    </SelectParameters> 

    <DeleteParameters> 
     <asp:Parameter Name="Student_Num" Type="Int32" /> 
    </DeleteParameters> 

나는 오류가 주변 어딘가에 생각 :

<UpdateParameters> 
     <asp:Parameter Name="Team_ID" Type="Int32" /> 
     <asp:Parameter Name="Team_Status" Type="String" /> 
     <asp:Parameter Name="Student_University" Type="String" /> 
     <asp:Parameter Name="Student_UniCountry" Type="String" /> 
     <asp:Parameter Name="Student_FullName" Type="String" /> 
     <asp:Parameter Name="Student_PreferredName" Type="String" /> 
     <asp:Parameter Name="Student_Email" Type="String" /> 
     <asp:Parameter Name="Student_Email2" Type="String" /> 
     <asp:Parameter Name="Student_Address1" Type="String" /> 
     <asp:Parameter Name="Student_Address2" Type="String" /> 
     <asp:Parameter Name="Student_Address3" Type="String" /> 
     <asp:Parameter Name="Student_AddressCity" Type="String" /> 
     <asp:Parameter Name="Student_AddressCountry" Type="String" /> 
     <asp:Parameter Name="Student_AddressPostcode" Type="String" /> 
     <asp:Parameter Name="Student_MobileCountryList" Type="String" /> 
     <asp:Parameter Name="Student_MobilePhone" Type="String" /> 
     <asp:Parameter Name="Student_Facebook" Type="String" /> 
     <asp:Parameter Name="Student_Skype" Type="String" /> 
     <asp:Parameter Name="Student_Gender" Type="String" /> 
     <asp:Parameter Name="Student_CourseRep" Type="String" /> 
     <asp:Parameter Name="Student_English" Type="String" /> 
     <asp:Parameter Name="Student_Broadband" Type="String" /> 
     <asp:Parameter Name="Student_CompAccess" Type="String" /> 
     <asp:Parameter Name="Recommender_Name" Type="String" /> 
     <asp:Parameter Name="Recommender_Email" Type="String" /> 
     <asp:Parameter Name="Recommender_Phone" Type="String" /> 
     <asp:Parameter Name="Student_Status" Type="String" /> 
     <asp:Parameter Name="Student_Num" Type="Int32" /> 
     </UpdateParameters> 

     <InsertParameters> 
     <asp:Parameter Name="Student_Num" Type="Int32" /> 
     <asp:Parameter Name="Team_ID" Type="Int32" /> 
     <asp:Parameter Name="Team_Status" Type="String" /> 
     <asp:Parameter Name="Student_University" Type="String" /> 
     <asp:Parameter Name="Student_UniCountry" Type="String" /> 
     <asp:Parameter Name="Student_FullName" Type="String" /> 
     <asp:Parameter Name="Student_PreferredName" Type="String" /> 
     <asp:Parameter Name="Student_Email" Type="String" /> 
     <asp:Parameter Name="Student_Email2" Type="String" /> 
     <asp:Parameter Name="Student_Address1" Type="String" /> 
     <asp:Parameter Name="Student_Address2" Type="String" /> 
     <asp:Parameter Name="Student_Address3" Type="String" /> 
     <asp:Parameter Name="Student_AddressCity" Type="String" /> 
     <asp:Parameter Name="Student_AddressCountry" Type="String" /> 
     <asp:Parameter Name="Student_AddressPostcode" Type="String" /> 
     <asp:Parameter Name="Student_MobileCountryList" Type="String" /> 
     <asp:Parameter Name="Student_MobilePhone" Type="String" /> 
     <asp:Parameter Name="Student_Facebook" Type="String" /> 
     <asp:Parameter Name="Student_Skype" Type="String" /> 
     <asp:Parameter Name="Student_Gender" Type="String" /> 
     <asp:Parameter Name="Student_CourseRep" Type="String" /> 
     <asp:Parameter Name="Student_English" Type="String" /> 
     <asp:Parameter Name="Student_Broadband" Type="String" /> 
     <asp:Parameter Name="Student_CompAccess" Type="String" /> 
     <asp:Parameter Name="Recommender_Name" Type="String" /> 
     <asp:Parameter Name="Recommender_Email" Type="String" /> 
     <asp:Parameter Name="Recommender_Phone" Type="String" /> 
     <asp:Parameter Name="Student_Status" Type="String" /> 
     </InsertParameters> 
</asp:AccessDataSource> 

<asp:Label ID="lbl_message2" runat="server" ForeColor="Black"> 
    Please select a student from the left column first, before you click the 
    continue button in order to update the student detail. 
</asp:Label><br /> 
<asp:Button ID="btn_continue" runat="server" Text="Continue" /><br /><br /> 
The detail of the student you have selected is shown below:<br /> 
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
    DataKeyNames="Student_Num" DataSourceID="AccessDataSource2" Height="32px" Width="536px"> 

<Fields> 
<asp:BoundField DataField="Student_Num" HeaderText="Student_Num" InsertVisible="False" 
ReadOnly="True" SortExpression="Student_Num" /> 
<asp:BoundField DataField="Team_ID" HeaderText="Team_ID" SortExpression="Team_ID" /> 
<asp:BoundField DataField="Team_Status" HeaderText="Team_Status" SortExpression="Team_Status" /> 
<asp:BoundField DataField="Student_University" HeaderText="Student_University" 
    SortExpression="Student_University" /> 
<asp:BoundField DataField="Student_UniCountry" HeaderText="Student_UniCountry" 
    SortExpression="Student_UniCountry" /> 
<asp:BoundField DataField="Student_FullName" HeaderText="Student_FullName" 
    SortExpression="Student_FullName" /> 
<asp:BoundField DataField="Student_PreferredName" HeaderText="Student_PreferredName" 
SortExpression="Student_PreferredName" /> 
<asp:BoundField DataField="Student_Email" HeaderText="Student_Email" 
    SortExpression="Student_Email" /> 
<asp:BoundField DataField="Student_Email2" HeaderText="Student_Email2" 
    SortExpression="Student_Email2" /> 
<asp:BoundField DataField="Student_Address1" HeaderText="Student_Address1" 
    SortExpression="Student_Address1" /> 
<asp:BoundField DataField="Student_Address2" HeaderText="Student_Address2" 
    SortExpression="Student_Address2" /> 
<asp:BoundField DataField="Student_Address3" HeaderText="Student_Address3" 
    SortExpression="Student_Address3" /> 
<asp:BoundField DataField="Student_AddressCity" HeaderText="Student_AddressCity" 
SortExpression="Student_AddressCity" /> 
<asp:BoundField DataField="Student_AddressCountry" HeaderText="Student_AddressCountry" 
SortExpression="Student_AddressCountry" /> 
<asp:BoundField DataField="Student_AddressPostcode" HeaderText="Student_AddressPostcode" 
SortExpression="Student_AddressPostcode" /> 
<asp:BoundField DataField="Student_MobileCountryList" HeaderText="Student_MobileCountryList" 
    SortExpression="Student_MobileCountryList" /> 
<asp:BoundField DataField="Student_MobilePhone" HeaderText="Student_MobilePhone" 
    SortExpression="Student_MobilePhone" /> 
<asp:BoundField DataField="Student_Facebook" HeaderText="Student_Facebook" 
    SortExpression="Student_Facebook" /> 
<asp:BoundField DataField="Student_Skype" HeaderText="Student_Skype" 
    SortExpression="Student_Skype" /> 
<asp:BoundField DataField="Student_Gender" HeaderText="Student_Gender" 
    SortExpression="Student_Gender" /> 
<asp:BoundField DataField="Student_CourseRep" HeaderText="Student_CourseRep" 
    SortExpression="Student_CourseRep" /> 
<asp:BoundField DataField="Student_English" HeaderText="Student_English" 
    SortExpression="Student_English" /> 
<asp:BoundField DataField="Student_Broadband" HeaderText="Student_Broadband" 
    SortExpression="Student_Broadband" /> 
<asp:BoundField DataField="Student_CompAccess" HeaderText="Student_CompAccess" 
    SortExpression="Student_CompAccess" /> 
<asp:BoundField DataField="Recommender_Name" HeaderText="Recommender_Name" 
    SortExpression="Recommender_Name" /> 
<asp:BoundField DataField="Recommender_Email" HeaderText="Recommender_Email" 
    SortExpression="Recommender_Email" /> 
<asp:BoundField DataField="Recommender_Phone" HeaderText="Recommender_Phone" 
    SortExpression="Recommender_Phone" /> 
<asp:BoundField DataField="Student_Status" HeaderText="Student_Status" 
    SortExpression="Student_Status" /> 
<asp:CommandField ShowEditButton="True" /> 
</Fields> 
</asp:DetailsView> 
+0

액세스 데이터베이스에서 옵션으로 끝날 수있는 필드 중 일부에서 빈 값을 허용하는지 확인하십시오. Access에 빈 값을 입력 할 수 없으면 사용자가 해당 필드에 정보를 입력하지 않으면 오류가 발생합니다. 예 : 사용자에게 Skype 계정이 없지만 액세스 필드에 빈 값이 허용되지 않아 오류가 발생합니다. –

답변

0

UpdateCommand에서 매개 변수의 순서가 UpdateParameters에서와 동일해야합니다

여기에 코드입니다. 또한 [Student_MobilePhoneCountryCode]이 UpdateParameter 목록에서 누락되어 있는지 확인하십시오.