当涂电脑培训——万飞科技——CMS开发:发布新闻
来源:互联网 发布:情绪管理 知乎 编辑:程序博客网 时间:2024/06/02 17:33
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient; //SQL Serve数据库命名空间
public partial class admin_News_add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//数据库连接字符串
string ConStr = "server=(local);user id=sa;pwd=netoffice;database=wf_data";
SqlConnection conn = new SqlConnection(ConStr);
conn.Open();
//执行查询语句加载DropDownList相关数据
string SqlStr = "select * from news_type";
//SqlDataAdapter ada = new SqlDataAdapter(SqlStr, conn);
SqlCommand myCommand = new SqlCommand(SqlStr, conn);
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
typeid.Items.Add(new ListItem(myReader["cType"].ToString(), myReader["typeid"].ToString()));
}
_Date.Text = DateTime.Now.ToString();
conn.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
string ConStr = "server=(local);user id=sa;pwd=netoffice;database=wf_data";
SqlConnection conn = new SqlConnection(ConStr);
conn.Open();
//添加数据
string SqlStr = "insert into news_list(title,_edit,type_id,_memo,_user) values('" + Title.Text + "','" + _Edit.Value.Replace("/n/r", "<br>") + "','" + typeid.Text + "','" + _memo.Text + "','" + _User.Text + "')";
SqlCommand com = new SqlCommand(SqlStr,conn);
com.ExecuteNonQuery();
conn.Close();
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="News_add.aspx.cs" Inherits="admin_News_add" %>
<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>
<!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>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td>
标题:<asp:TextBox ID="Title" runat="server" Width="525px"></asp:TextBox>
</td>
</tr>
<tr>
<td>
分类:<asp:DropDownList ID="typeid" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<FCKeditorV2:FCKeditor ID="_Edit" runat="server" Height="400px">
</FCKeditorV2:FCKeditor>
</td>
</tr>
<tr>
<td>
备注:<asp:TextBox ID="_memo" runat="server" Height="78px" TextMode="MultiLine"
Width="100%"></asp:TextBox>
</td>
</tr>
<tr>
<td>
日期:<asp:TextBox ID="_Date" runat="server"></asp:TextBox>
发布人:<asp:TextBox ID="_User" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td style="text-align: center">
<asp:Button ID="Button1" runat="server" Text="发布信息" onclick="Button1_Click" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
www.dtwfkj.com
- 当涂电脑培训——万飞科技——CMS开发:发布新闻
- autocad 2010新安装的应用程序不正确(当涂学电脑,当涂万飞科技)
- 新闻发布系统——个人见解
- 牛腩新闻发布系统——总结
- 【新闻发布系统】——存储过程
- 牛腩新闻发布系统——触发器
- 牛腩新闻发布系统——总结
- 【新闻发布系统】——再回首
- 【牛腩新闻发布系统】——总结
- 【牛腩】——新闻发布系统收工
- 新闻发布系统——错误汇集
- 【牛腩新闻发布系统】——总结
- 【牛腩新闻发布系统】——CSS
- 新闻发布系统—完后总结
- 牛腩新闻发布系统——发布以及远程访问
- 牛腩新闻发布系统——网站发布
- 【BS学习】牛腩新闻发布系统——网站发布
- 牛腩新闻发布系统———如何在开发中使用第三方控件
- 【转】网络小说
- 数论基础
- linux监控多线程io
- 堆和栈的区别
- x264运动估计六边形搜索源代码解析
- 当涂电脑培训——万飞科技——CMS开发:发布新闻
- 【转】“上善若水”是什么意思?
- struts2 整合 Spring开发,简单数据添加小例子
- 程序的异常处理框架
- 【转】男孩,请好好珍惜爱你的女孩
- 【转】女人们不应该让男人太累
- java递归查找某一路径下文件代码
- 重拾海子--城市的纷杂
- 個人SOHO團隊 (網站,遊戲開發)