now i want to update the absence record but cos it's repeated it will only update one record what i want is to apply the update on all other records ? hope u can help me .thankscan you rephrase your question? What is the UPDATE statement you have currently?|||hello ndinakar, i will explain my prob again i have a page has a details view and sqldatasource the details show one record as u know there are some records repeated as in the image i posted i'm using the sqldatasource auto statement update, but it doesnt update and it did updated once but only one value and the other repeatd values still as they are what i want is when i update one value it auto update all other repeated values, hope this clear and hope u can help me.|||What is the UPDATE statement you have? Do you have any primary key for the table? Pls post the table structure and some sample data.|||ok this my table's columns :
ID uniqueidentifier(primary key)
serial Int
stage(1st grade,2nd grade,...etc) char
class nchar
subject varchar
marks char
total nchar
absence nchar
ranking char
the update statement is the auto generated statement in the sqldatasource here's the sqldatasource code in my page:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:aspnetcon %>" DeleteCommand="DELETE FROM [grades] WHERE [id] = @.original_id AND [serial] = @.original_serial AND [stage] = @.original_stage AND [class] = @.original_class AND [subject] = @.original_subject AND [marks] = @.original_marks AND [total1] = @.original_total1 AND [total2] = @.original_total2 AND [status] = @.original_status AND [absence] = @.original_absence AND [ranking] = @.original_ranking"
InsertCommand="INSERT INTO [grades] ([id], [serial], [stage], [class], [subject], [marks], [total1], [total2], [status], [absence], [ranking]) VALUES (@.id, @.serial, @.stage, @.class, @.subject, @.marks, @.total1, @.total2, @.status, @.absence, @.ranking)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [grades] WHERE (([stage] = @.stage) AND ([subject] = @.subject) AND ([class] = @.class))"
UpdateCommand="UPDATE [grades] SET [serial] = @.serial, [stage] = @.stage, [class] = @.class, [subject] = @.subject, [marks] = @.marks, [total1] = @.total1, [total2] = @.total2, [status] = @.status, [absence] = @.absence, [ranking] = @.ranking WHERE [id] = @.original_id AND [serial] = @.original_serial AND [stage] = @.original_stage AND [class] = @.original_class AND [subject] = @.original_subject AND [marks] = @.original_marks AND [total1] = @.original_total1 AND [total2] = @.original_total2 AND [status] = @.original_status AND [absence] = @.original_absence AND [ranking] = @.original_ranking">
<DeleteParameters>
<asp:Parameter Name="original_id" Type="Object" />
<asp:Parameter Name="original_serial" Type="Int32" />
<asp:Parameter Name="original_stage" Type="String" />
<asp:Parameter Name="original_class" Type="String" />
<asp:Parameter Name="original_subject" Type="String" />
<asp:Parameter Name="original_marks" Type="String" />
<asp:Parameter Name="original_total1" Type="String" />
<asp:Parameter Name="original_total2" Type="String" />
<asp:Parameter Name="original_status" Type="String" />
<asp:Parameter Name="original_absence" Type="String" />
<asp:Parameter Name="original_ranking" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="serial" Type="Int32" />
<asp:Parameter Name="stage" Type="String" />
<asp:Parameter Name="class" Type="String" />
<asp:Parameter Name="subject" Type="String" />
<asp:Parameter Name="marks" Type="String" />
<asp:Parameter Name="total1" Type="String" />
<asp:Parameter Name="total2" Type="String" />
<asp:Parameter Name="status" Type="String" />
<asp:Parameter Name="absence" Type="String" />
<asp:Parameter Name="ranking" Type="String" />
<asp:Parameter Name="original_id" Type="Object" />
<asp:Parameter Name="original_serial" Type="Int32" />
<asp:Parameter Name="original_stage" Type="String" />
<asp:Parameter Name="original_class" Type="String" />
<asp:Parameter Name="original_subject" Type="String" />
<asp:Parameter Name="original_marks" Type="String" />
<asp:Parameter Name="original_total1" Type="String" />
<asp:Parameter Name="original_total2" Type="String" />
<asp:Parameter Name="original_status" Type="String" />
<asp:Parameter Name="original_absence" Type="String" />
<asp:Parameter Name="original_ranking" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:CookieParameter CookieName="stg" Name="stage" Type="String" />
<asp:CookieParameter CookieName="sub" Name="subject" Type="String" />
<asp:ControlParameter ControlID="DropDownList1" Name="class" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="id" Type="Object" />
<asp:Parameter Name="serial" Type="Int32" />
<asp:Parameter Name="stage" Type="String" />
<asp:Parameter Name="class" Type="String" />
<asp:Parameter Name="subject" Type="String" />
<asp:Parameter Name="marks" Type="String" />
<asp:Parameter Name="total1" Type="String" />
<asp:Parameter Name="total2" Type="String" />
<asp:Parameter Name="status" Type="String" />
<asp:Parameter Name="absence" Type="String" />
<asp:Parameter Name="ranking" Type="String" />
</InsertParameters>
</asp:SqlDataSource
the problem is there's a 5 or 6 subjects to every student and each subject in the table has a repeated record here's aone studentin my table so as u can see in this image the repeating records for example the absence and status columns, what i want is really simple i want when i update the absence for example i want to apply that update on all records not only one record hope u understand me .thanks for the help|||sorry. I am having internet problems at home so I could not reply earlier. I think if you remove the @.original_Id parameter from your where clause you could update all the records. Basically your WHERE condition is limiting the records. Based on your screenshot it appears all the other columns have same values except the @.original_id which is not in the screenshot. So I am guessing that is the condition limiting your results.
No comments:
Post a Comment