菜鸟求教高手!急用(新闻发布系统,增删添加页面问题)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="newsAdminDetail.aspx.cs" Inherits="newsInsert" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>新闻增加</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
// <!CDATA[
function P1_onclick() {
}
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p id="P1" class="style4" onclick="return P1_onclick()" style="left: -21px; behavior: url(newsAdmin.aspx);
vertical-align: bottom; width: 95%; position: absolute; top: 19px; text-align: right">
<img align="left" class="style3" src="image/newsCenter_r2_c1.jpg" />
<a class="nav" href="news.aspx"><span style="font-size: 10pt; color: #006699">回到主页</span></a>
<asp:LoginStatus ID="LoginStatus2" runat="server" Height="4px" LogoutAction="Redirect"
LogoutPageUrl="~/news.aspx" Width="32px" />
</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BorderWidth="0px"
Caption="新闻数据管理" CellPadding="4" CellSpacing="1" CssClass="Forumline" DataKeyNames="news_id"
DataSourceID="SqlDataSource1" DefaultMode="Edit" Height="50px" Width="95%">
<RowStyle CssClass="row1" HorizontalAlign="Left" />
<FieldHeaderStyle CssClass="row3" Font-Bold="True" HorizontalAlign="Center" Width="80px" />
<Fields>
<asp:TemplateField HeaderText="类别">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("news_type") %>'>
<asp:ListItem>政治</asp:ListItem>
<asp:ListItem>经济</asp:ListItem>
<asp:ListItem>文体</asp:ListItem>
<asp:ListItem>生活</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("news_type") %>'>
<asp:ListItem>政治</asp:ListItem>
<asp:ListItem>经济</asp:ListItem>
<asp:ListItem>文体</asp:ListItem>
<asp:ListItem>生活</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="日期">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Now() %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("news_date") %>'></asp:Label>
</InsertItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="news_subject" HeaderText="标题" SortExpression="news_subject" />
<asp:BoundField DataField="news_editor" HeaderText="编辑者" SortExpression="news_editor" />
<asp:TemplateField HeaderText="内容">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Height="100px" Text='<%# Bind("news_content") %>'
TextMode="MultiLine" Width="450px"></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Height="100px" Text='<%# Bind("news_content") %>'
TextMode="MultiLine" Width="450px"></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
</Fields>
<AlternatingRowStyle CssClass="row2" />
</asp:DetailsView>
</LoggedInTemplate>
<AnonymousTemplate>
<img src="image/shou.jpg" />请先执行<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="~/newsInsert.aspx" />
操作
</AnonymousTemplate>
</asp:LoginView>
<br />
<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [news] WHERE [news_id] = @news_id" InsertCommand="INSERT INTO [news] ([news_id], [news_type], [news_date], [news_subject], [news_content], [news_editor]) VALUES (@news_id, @news_type, @news_date, @news_subject, @news_content, @news_editor)"
SelectCommand="SELECT * FROM [news]"
UpdateCommand="UPDATE [news] SET [news_type] = @news_type, [news_date] = @news_date, [news_subject] = @news_subject, [news_content] = @news_content, [news_editor] = @news_editor WHERE [news_id] = @news_id">
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="news_type" Type="String" />
<asp:Parameter DbType="Date" Name="news_date" />
<asp:Parameter Name="news_subject" Type="String" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_editor" Type="String" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="news_id" Type="Int32" />
<asp:Parameter Name="news_type" Type="String" />
<asp:Parameter DbType="Date" Name="news_date" />
<asp:Parameter Name="news_subject" Type="String" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_editor" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
========================================================================================
新闻发布系统的修改、添加、删除页面。。
请大侠赐教。。按添加之后,还是出现更新的页面。。
还有更新出现SQL不支持date数据。。。
其中有错误说。。 <asp:TextBox ID="TextBox1" runat="server" Text='<%# Now() %>'></asp:TextBox>
这个Now是不是有问题。。他说上下文中不存在名称。。不过,书上是这么写的。。
菜鸟求大侠指教!!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>新闻增加</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
// <!CDATA[
function P1_onclick() {
}
// ]]>
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<p id="P1" class="style4" onclick="return P1_onclick()" style="left: -21px; behavior: url(newsAdmin.aspx);
vertical-align: bottom; width: 95%; position: absolute; top: 19px; text-align: right">
<img align="left" class="style3" src="image/newsCenter_r2_c1.jpg" />
<a class="nav" href="news.aspx"><span style="font-size: 10pt; color: #006699">回到主页</span></a>
<asp:LoginStatus ID="LoginStatus2" runat="server" Height="4px" LogoutAction="Redirect"
LogoutPageUrl="~/news.aspx" Width="32px" />
</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<asp:LoginView ID="LoginView1" runat="server">
<LoggedInTemplate>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BorderWidth="0px"
Caption="新闻数据管理" CellPadding="4" CellSpacing="1" CssClass="Forumline" DataKeyNames="news_id"
DataSourceID="SqlDataSource1" DefaultMode="Edit" Height="50px" Width="95%">
<RowStyle CssClass="row1" HorizontalAlign="Left" />
<FieldHeaderStyle CssClass="row3" Font-Bold="True" HorizontalAlign="Center" Width="80px" />
<Fields>
<asp:TemplateField HeaderText="类别">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("news_type") %>'>
<asp:ListItem>政治</asp:ListItem>
<asp:ListItem>经济</asp:ListItem>
<asp:ListItem>文体</asp:ListItem>
<asp:ListItem>生活</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("news_type") %>'>
<asp:ListItem>政治</asp:ListItem>
<asp:ListItem>经济</asp:ListItem>
<asp:ListItem>文体</asp:ListItem>
<asp:ListItem>生活</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="日期">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Now() %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("news_date") %>'></asp:Label>
</InsertItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="news_subject" HeaderText="标题" SortExpression="news_subject" />
<asp:BoundField DataField="news_editor" HeaderText="编辑者" SortExpression="news_editor" />
<asp:TemplateField HeaderText="内容">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Height="100px" Text='<%# Bind("news_content") %>'
TextMode="MultiLine" Width="450px"></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Height="100px" Text='<%# Bind("news_content") %>'
TextMode="MultiLine" Width="450px"></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
</Fields>
<AlternatingRowStyle CssClass="row2" />
</asp:DetailsView>
</LoggedInTemplate>
<AnonymousTemplate>
<img src="image/shou.jpg" />请先执行<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="~/newsInsert.aspx" />
操作
</AnonymousTemplate>
</asp:LoginView>
<br />
<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [news] WHERE [news_id] = @news_id" InsertCommand="INSERT INTO [news] ([news_id], [news_type], [news_date], [news_subject], [news_content], [news_editor]) VALUES (@news_id, @news_type, @news_date, @news_subject, @news_content, @news_editor)"
SelectCommand="SELECT * FROM [news]"
UpdateCommand="UPDATE [news] SET [news_type] = @news_type, [news_date] = @news_date, [news_subject] = @news_subject, [news_content] = @news_content, [news_editor] = @news_editor WHERE [news_id] = @news_id">
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="news_type" Type="String" />
<asp:Parameter DbType="Date" Name="news_date" />
<asp:Parameter Name="news_subject" Type="String" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_editor" Type="String" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="news_id" Type="Int32" />
<asp:Parameter Name="news_type" Type="String" />
<asp:Parameter DbType="Date" Name="news_date" />
<asp:Parameter Name="news_subject" Type="String" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_editor" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
========================================================================================
新闻发布系统的修改、添加、删除页面。。
请大侠赐教。。按添加之后,还是出现更新的页面。。
还有更新出现SQL不支持date数据。。。
其中有错误说。。 <asp:TextBox ID="TextBox1" runat="server" Text='<%# Now() %>'></asp:TextBox>
这个Now是不是有问题。。他说上下文中不存在名称。。不过,书上是这么写的。。
菜鸟求大侠指教!!
...全文
相关推荐
菜鸟驿站包裹管理系统.zip
通过学习和分析这个系统,不仅可以加深对C语言的理解,还能了解到如何运用编程解决实际问题,提升自身的编程技能和项目经验。
printer:测试 web 页面调用 菜鸟打印组件 和 Lodop打印组件
总的来说,结合Vue.js、WebSocket以及菜鸟打印组件和Lodop,我们可以构建一个高效、易用且实时的Web打印系统,满足各种复杂的打印需求。
TrintyCore菜鸟工具
**脚本编辑**:对于需要自定义的游戏逻辑,工具提供了一个脚本编辑器,使得修改或添加新的事件处理成为可能。5. **日志监控**:工具可以帮助用户实时查看服务器的日志,及时发现和解决运行中的问题。
简单的系统重装菜鸟也可以自己来
让菜鸟一目了然!自己也会重装系统!解决一些让人头疼的电脑问题
菜鸟宝典-(电脑基础、操作系统、常用软件、程序语言、网络知识)
版权所有:HOC网络安全小组(www.21cnhoc.com)制 作 人:玩火的女人我是一个大菜鸟,之所以弄这个菜鸟宝典是希望跟我一样菜的菜鸟能得到进步。这些文章有一部分是我参考一些书籍按自己的理解去


