This is a migrated thread and some comments may be shown as answers.

[Solved] Able to insert but not update

4 Answers 136 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 09 Nov 2009, 03:23 AM
hi

I am able to insert, but when try to update, it doesn't give an error and it didn;t get updated. here is my code

       <telerik:RadScheduler ID="RadScheduler1" runat="server"
                    DataEndField="Appt_EDateTime" DataKeyField="Appt_ID"
                    DataSourceID="sdsAppointment" DataStartField="Appt_SDateTime" 
                    DayStartTime="09:00:00" DayEndTime="22:00:00"
                    DataSubjectField="Appt_Remark" RowHeight="35px" 
                    HoursPanelTimeFormat="hh:mm" Skin="Outlook" TimeLabelRowSpan="1"
                    EnableCustomAttributeEditing="True" CustomAttributeNames="Cust_Name,Appt_Remark,Room_No"
                    ValidationGroup="RadScheduler1" NumberOfHoveredRows="1"
                    TimelineView-UserSelectable="False" MonthView-UserSelectable="False"
                    SelectedView="WeekView" ShowAllDayRow="False" Width="99.9%"  MinimumInlineFormHeight="200"
                    style="top: 0px; left: 0px; height: 622px"
                    StartEditingInAdvancedForm="False">                    
                    <AppointmentTemplate>               
                    <%#Eval("Cust_Name")%>
                    <br />
                    Room:<%#Eval("Room_No")%>
                    <br />
                    <%#Eval("Appt_Remark")%>
            </AppointmentTemplate>

<InlineInsertTemplate>
                Cust Name:<br />
            <asp:TextBox runat="server" ID="Cust_NameTextBox" Text='<%# Bind("Cust_Name") %>' Width="200px"  BorderColor="DarkGray" BorderWidth="1px"  BorderStyle="Solid"></asp:TextBox>&nbsp;
               &nbsp;<br />
                    Room:&nbsp;<telerik:RadComboBox ID="drpRoomSelect" selectedValue='<%# Bind("Room_No") %>' DataSourceID="sdsRoomSelect" DataValueField="Room_No"  DataTextField="Room_No"  runat="server">
                    </telerik:RadComboBox>
                   &nbsp;<br />Remark:&nbsp;<asp:TextBox runat="server" ID="Appt_RemarkTextBox" Text='<%# Bind("Appt_Remark") %>' TextMode="MultiLine" Height="100px" Width="200px"  BorderColor="DarkGray" BorderWidth="1px"  BorderStyle="Solid"></asp:TextBox>

                 <asp:LinkButton runat="server" ID="InsertLinkButton" CommandName="Insert" Text="Insert"></asp:LinkButton>&nbsp;
                 <asp:LinkButton runat="server" ID="CancelLinkButton" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
            </InlineInsertTemplate>
           
            <InlineEditTemplate>
                  &nbsp;Cust Name:&nbsp;
            &nbsp;<asp:TextBox runat="server" ID="Cust_NameTextBox" Text='<%# Bind("Cust_Name") %>' BorderColor="DarkGray" BorderWidth="1px"  Width="200px" BorderStyle="Solid"></asp:TextBox>&nbsp;
                &nbsp;<br />
                    Room:&nbsp;<telerik:RadComboBox ID="drpRoomSelect" selectedValue='<%# Bind("Room_No") %>' DataSourceID="sdsRoomSelect" DataValueField="Room_No"  DataTextField="Room_No"  runat="server">
                    </telerik:RadComboBox>
                    &nbsp;<br />Remark:&nbsp;<asp:TextBox runat="server" ID="Appt_RemarkTextBox" Text='<%# Bind("Appt_Remark") %>' TextMode="MultiLine" BorderColor="DarkGray" BorderWidth="1px"  BorderStyle="Solid" Height="100px" Width="200px"></asp:TextBox>
                   
                 <asp:LinkButton runat="server" ID="UpdateLinkButton" CommandName="Update" Text="Update"></asp:LinkButton>&nbsp;
                 <asp:LinkButton runat="server" ID="CancelLinkButton" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
            </InlineEditTemplate>




<asp:SqlDataSource ID="sdsAppointment" runat="server"
                    ConnectionString="<%$ ConnectionStrings:MConnectionString %>"
                    DeleteCommand="spAppointment_Delete" DeleteCommandType="StoredProcedure"
                    InsertCommand="spAppointment_Insert" InsertCommandType="StoredProcedure"
                    SelectCommand="spAppointment_Select" SelectCommandType="StoredProcedure"
                    UpdateCommand="spAppointment_Update" UpdateCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:CookieParameter CookieName="branchid" Name="Branch_ID" Type="Int32" />
                    </SelectParameters>
                    <DeleteParameters>
                        <asp:Parameter Name="Appt_ID" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Appt_ID" Type="Int32" />
                        <asp:Parameter Name="Appt_SDateTime" Type="DateTime" />
                        <asp:Parameter Name="Appt_EDateTime" Type="DateTime" />
                        <asp:Parameter Name="Appt_Remark" Type="String" />
                        <asp:Parameter Name="Cust_Name" Type="String" />
                        <asp:CookieParameter Name="Branch_ID" CookieName="branchid" Type="Int16" />
                        <asp:Parameter Name="Room_No" Type="String" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Appt_SDateTime" Type="DateTime"/>
                        <asp:Parameter Name="Appt_EDateTime" Type="DateTime" />
                        <asp:Parameter Name="Appt_Remark" Type="String" />
                        <asp:Parameter Name="Cust_Name" Type="String" />
                        <asp:CookieParameter Name="Branch_ID" CookieName="branchid" Type="Int16" />
                        <asp:Parameter Name="Room_No" Type="String" />
                    </InsertParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="sdsRoomSelect" runat="server"
                    ConnectionString="<%$ ConnectionStrings:MConnectionString %>"
                    SelectCommand="spAppointment_RoomSelect" SelectCommandType="StoredProcedure">
                    <SelectParameters>
                        <asp:CookieParameter CookieName="branchid" Name="Branch_ID" Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>

ALTER proc [dbo].[spAppointment_Update]
@Appt_ID as int,
@Appt_SDateTime datetime = null,
@Appt_EDateTime datetime = null,
@Appt_Remark as nvarchar(1000),
@Cust_Name as Nvarchar(100),
@Branch_ID as int,
@Room_No as Nvarchar(50)
as
UPDATE [dbo].[Appointment]
   SET [Appt_SDateTime] = @Appt_SDateTime
      ,[Appt_EDateTime] = @Appt_EDateTime
      ,[Appt_Remark] = @Appt_Remark
      ,[Cust_Name] = @Cust_Name
      ,[Branch_ID] = @Branch_ID
      ,[Room_No] = @Room_No
    WHERE Appt_ID = @Appt_ID

4 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 12 Nov 2009, 07:49 AM
Hi L,

Can you please use the SQL Profiler to observe the sql query that is running against the database when you make an update? This will shed some light on where the problem is.

Regards,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
L
Top achievements
Rank 1
answered on 12 Nov 2009, 11:43 AM
hi

It seems that the datasubjectfield is giving the problem. The rest of the fields are able to update except the field specify in the datasubjectfield. How should i solve this? Thanks
0
Accepted
Peter
Telerik team
answered on 16 Nov 2009, 04:07 PM
Hi L,

Can you isolate the problem in a simple working demo and send it to us for testing via a support ticket?

Regards,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
L
Top achievements
Rank 1
answered on 17 Nov 2009, 01:27 AM
hi

My code is posted in this forum above. But, i have managed to workaround by using another field for datasubjectfield eg an ID. Thanks 
Tags
Scheduler
Asked by
L
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
L
Top achievements
Rank 1
Peter
Telerik team
Share this question
or