📄 gpgl.aspx
字号:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Gpgl.aspx.cs" Inherits="WebForm_Gpgl" Title="购票管理" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 553px; height: 169px">
<tr>
<td style="width: 34px">
</td>
<td style="width: 269px">
车次编号:<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
DataTextField="车次编号" DataValueField="车次编号" Width="124px" AutoPostBack="True">
</asp:DropDownList>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="查询" /><br />
数量:<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="请输入数字" ValidationExpression="\d+"></asp:RegularExpressionValidator></td>
<td style="width: 130px">
<asp:Button ID="Button1" runat="server" Text="购票" OnClick="Button1_Click" /></td>
</tr>
<tr>
<td style="width: 34px; height: 30px">
</td>
<td colspan="2" style="height: 30px">
<asp:GridView ID="GridView1" runat="server" CellPadding="4"
DataKeyNames="车次编号" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT unbuy.车次编号, unbuy.票价, @数量 AS 数量, @总价 AS 总价 FROM unbuy WHERE (unbuy.车次编号 = @车次编号)" InsertCommand="INSERT INTO buy(车次编号, 目的地点, 发车地点, 票价, 数量, 发车时间) VALUES (@车次编号, @目的地点, @发车地点, @票价, @数量, @发车时间)" UpdateCommand="UPDATE unbuy SET 数量 = @数量 WHERE (车次编号 = @车次编号)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="数量" PropertyName="Text" />
<asp:SessionParameter Name="总价" SessionField="zongjia" />
<asp:ControlParameter ControlID="DropDownList1" Name="车次编号" PropertyName="SelectedValue" />
</SelectParameters>
<UpdateParameters>
<asp:SessionParameter Name="数量" SessionField="shuliang" />
<asp:ControlParameter ControlID="DropDownList1" Name="车次编号" PropertyName="SelectedValue" />
</UpdateParameters>
<InsertParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="车次编号" PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="GridView3" Name="目的地点" PropertyName="Rows[0].Cells[2].Text" />
<asp:ControlParameter ControlID="GridView3" Name="发车地点" PropertyName="Rows[0].Cells[1].Text" />
<asp:ControlParameter ControlID="GridView3" Name="票价" PropertyName="Rows[0].Cells[3].Text" />
<asp:ControlParameter ControlID="TextBox1" Name="数量" PropertyName="Text" />
<asp:ControlParameter ControlID="GridView3" Name="发车时间" PropertyName="Rows[0].Cells[5].Text" />
</InsertParameters>
</asp:SqlDataSource>
<asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label></td>
</tr>
<tr>
<td style="width: 34px">
</td>
<td colspan="2">
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="车次编号" DataSourceID="SqlDataSource3" ForeColor="#333333" GridLines="None"
Width="524px">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="车次编号" HeaderText="车次编号" ReadOnly="True" SortExpression="车次编号" />
<asp:BoundField DataField="发车地点" HeaderText="发车地点" SortExpression="发车地点" />
<asp:BoundField DataField="目的地点" HeaderText="目的地点" SortExpression="目的地点" />
<asp:BoundField DataField="票价" HeaderText="票价" SortExpression="票价" />
<asp:BoundField DataField="数量" HeaderText="数量" SortExpression="数量" />
<asp:BoundField DataField="发车时间" HeaderText="发车时间" SortExpression="发车时间" />
<asp:BoundField DataField="备注" HeaderText="备注" SortExpression="备注" />
</Columns>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [unbuy] WHERE ([车次编号] = @车次编号)">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="车次编号" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
<td style="width: 34px; height: 21px">
</td>
<td colspan="2" style="height: 21px">
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="车次编号" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"
Width="524px">
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="车次编号" HeaderText="车次编号" ReadOnly="True" SortExpression="车次编号" />
<asp:BoundField DataField="发车地点" HeaderText="发车地点" SortExpression="发车地点" />
<asp:BoundField DataField="目的地点" HeaderText="目的地点" SortExpression="目的地点" />
<asp:BoundField DataField="票价" HeaderText="票价" SortExpression="票价" />
<asp:BoundField DataField="数量" HeaderText="数量" SortExpression="数量" />
<asp:BoundField DataField="发车时间" HeaderText="发车时间" SortExpression="发车时间" />
<asp:BoundField DataField="备注" HeaderText="备注" SortExpression="备注" />
</Columns>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [unbuy]"></asp:SqlDataSource>
</td>
</tr>
</table>
</asp:Content>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -