![]() |
#2
tottibuffon2010-10-14 12:18
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SqlDataSource.aspx.cs" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. <html xmlns="http://www. > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:StudentDBConnectionString %>" DeleteCommand="DELETE FROM [studentinfo] WHERE [st_id] = @st_id" InsertCommand="INSERT INTO [studentinfo] ([st_id], [st_name], [st_sex], [st_brithdat], [st_city]) VALUES (@st_id, @st_name, @st_sex, @st_brithdat, @st_city)" OnSelecting="SqlDataSource1_Selecting" SelectCommand="SELECT * FROM [studentinfo] ORDER BY [st_id]" UpdateCommand="UPDATE [studentinfo] SET [st_name] = @st_name, [st_sex] = @st_sex, [st_brithdat] = @st_brithdat, [st_city] = @st_city WHERE [st_id] = @st_id"> <DeleteParameters> <asp:Parameter Name="st_id" Type="String" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="st_name" Type="String" /> <asp:Parameter Name="st_sex" Type="String" /> <asp:Parameter Name="st_brithdat" Type="DateTime" /> <asp:Parameter Name="st_city" Type="String" /> <asp:Parameter Name="st_id" Type="String" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="st_id" Type="String" /> <asp:Parameter Name="st_name" Type="String" /> <asp:Parameter Name="st_sex" Type="String" /> <asp:Parameter Name="st_brithdat" Type="DateTime" /> <asp:Parameter Name="st_city" Type="String" /> </InsertParameters> </asp:SqlDataSource> </div> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="st_id" DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None"> <Columns> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /> <asp:BoundField DataField="st_id" HeaderText="st_id" ReadOnly="True" SortExpression="st_id" /> <asp:BoundField DataField="st_name" HeaderText="st_name" SortExpression="st_name" /> <asp:BoundField DataField="st_sex" HeaderText="st_sex" SortExpression="st_sex" /> <asp:BoundField DataField="st_brithdat" HeaderText="st_brithdat" SortExpression="st_brithdat" /> <asp:BoundField DataField="st_city" HeaderText="st_city" SortExpression="st_city" /> </Columns> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> </form> </body> </html> |
编程论坛
ASP.NET技术论坛
错误 1 “ASP.sqldatasource_aspx”并不包含“SqlDataSource1_Selecting”的定义 E:\点NET\DataSourc
tottibuffon
发布于
2010-10-14 12:16,
2842 次点击
如题