选择最高值并在另一列中显示的过程 [英] Procedure for selecting top value and display in another column..
本文介绍了选择最高值并在另一列中显示的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<asp:GridView ID="grdcareplan" runat="server" CellPadding="5" CssClass="CustomGrid" ShowFooter="True"
AutoGenerateColumns="False" GridLines="Horizontal" AllowPaging="True" DataKeyNames="ParameterId"
Width="950px" onselectedindexchanged="grdcareplan_SelectedIndexChanged1"
onpageindexchanging="grdcareplan_PageIndexChanging" Height="16px"
style="margin-right: 0px" onrowediting="grdcareplan_RowEditing" onrowcancelingedit="grdcareplan_RowCancelingEdit"
onrowupdating="grdcareplan_RowUpdating"
onrowdeleting="grdcareplan_RowDeleting"
EmptyDataText="No Record found for this Item">
<columns>
<asp:CommandField EditText="<img src='images/HMS Buttons/edit_icon.png'>" ShowEditButton="true" UpdateText="<img src='images/HMS Buttons/edit_icon.png'>" />
<asp:TemplateField>
<itemstyle cssclass="w" />
<itemtemplate>
<asp:ImageButton ID="Imgbtnsave" runat="server"
ImageUrl="~/images/HMS Buttons/LaunchIcon.png" CssClass="icon"
onclick="Imgbtnsave_Click"/>
</itemtemplate>
<asp:BoundField DataField="ParameterName" HeaderText="Scheduled Items"
ReadOnly="True" />
<asp:TemplateField HeaderText="Target Value">
<itemtemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("Target_Value") %>'>
</itemtemplate>
<edititemtemplate>
<asp:TextBox ID="txttargetvalue" runat="server"
Text='<%# Bind("Target_Value") %>' CssClass="textboxInGrid">
</edititemtemplate>
<%--<asp:BoundField DataField="UOM" HeaderText="UOM" ReadOnly="True" />--%>
<asp:TemplateField HeaderText="Last dt">
<itemtemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Last_Date") %>'>
</itemtemplate>
<edititemtemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("Last_Date") %>'>
</edititemtemplate>
<asp:TemplateField HeaderText="Result">
<itemtemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Result") %>'>
</itemtemplate>
<edititemtemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("Result") %>'>
</edititemtemplate>
<asp:TemplateField HeaderText="Test dt">
<itemtemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Bind("Current_Test_Date") %>'>
</itemtemplate>
<edititemtemplate>
<asp:TextBox ID="txttestdate" runat="server" Text='<%# Bind("Current_Test_Date") %>' CssClass="textboxInGrid">
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txttestdate" Format="yy/dd/MM">
</edititemtemplate>
<%-- <asp:BoundField HeaderText="Test Result" />--%>
<asp:TemplateField HeaderText="Test Result">
<itemtemplate>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("Test_Result") %>'>
</itemtemplate>
<edititemtemplate>
<asp:TextBox ID="txttestresult" runat="server" Text='<%# Bind("Test_Result") %>' CssClass="textboxInGrid">
</edititemtemplate>
<asp:TemplateField HeaderText="Measurement Frequency">
<itemtemplate>
<asp:Label ID="Label2" runat="server"
Text='<%# Bind("Measurement_Frequency") %>'>
</itemtemplate>
<edititemtemplate>
<asp:DropDownList ID="ddlMeasurementFrequency" runat="server" AutoPostBack="true"
onselectedindexchanged="ddlMeasurementFrequency_SelectedIndexChanged">
<asp:ListItem>Select Frequency
<asp:ListItem Value="1">Daily
<asp:ListItem Value="2">Weekly
<asp:ListItem Value="3">Fortnightly
<asp:ListItem Value="4">Monthly
<asp:ListItem Value="5">Quarterly
<asp:ListItem Value="6"> Half Yearly
<asp:ListItem Value="7">Yearly
<asp:ListItem Value="8">Others
</edititemtemplate>
<asp:TemplateField HeaderText="Next Due dt">
<itemtemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("Next_Due_Date") %>'>
</itemtemplate>
<edititemtemplate>
<asp:TextBox ID="txtnextduedate" runat="server" Text='<%# Bind("Next_Due_Date") %>' CssClass="textboxInGrid">
<asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtnextduedate" Format="yy/dd/MM">
</edititemtemplate>
</columns>
<footerstyle cssclass="GridFooter" />
<HeaderStyle CssClass="grdheaderstyle"></HeaderStyle>
<rowstyle cssclass="grdrowstyle" />
This is my procedure..which i tried..but it is not working
This is my procedure..which i tried..but it is not working
DROP PROCEDURE IF EXISTS hms.Select_LastDate_Result;
CREATE PROCEDURE hms.`Select_LastDate_Result`()
BEGIN
SELECT top(1)Last_Date, Result
FROM patient_progress_tracking_details
WHERE (SELECT top(1) Current_Test_Date, Test_Result
FROM patient_progress_tracking_details
ORDER BY Current_Test_Date, Test_Result DESC);
END;
This is my grid ...on save Image button click,I want to take value from Current_Test_Date and Test_Result and that should be displayed in Last_Date and Result,What Will be the procedure for that...
This is my grid ...on save Image button click,I want to take value from Current_Test_Date and Test_Result and that should be displayed in Last_Date and Result,What Will be the procedure for that...
推荐答案
Try this
Try this
SELECT top 1 Current_Test_Date as Last_Date, Test_Result as Result
FROM patient_progress_tracking_details (NOLOCK)
ORDER BY Current_Test_Date, Test_Result DESC
Accept Answer if it helps you :)
这篇关于选择最高值并在另一列中显示的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文