ChangeArticle.cs
(开头部分) 11KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace BBS
{
public partial class ChangeArticle : Form
{
public string title_text;
public string abstract_text;
public string content_text;
public string category_name;
public ChangeArticle()
{
InitializeComponent();
}
private void ChangeArticle_Load(object sender, EventArgs e)
{
// 窗口初始化设置
// 焦点重设
button_search.Focus();
// 文章内容加载
string sqlconf = "Server=127.0.0.1;User ID=root;Password=51aspx;Database=bbs_csharp;";
MySqlConnection sqlConnection = new MySqlConnection(sqlconf);
sqlConnection.Open();
string sql1 = "select title,abstract,content,name from article right join category on category_id = category.id where article.id = '" + DataShare.ChangeArticleId + "';";
MySqlCommand sqlCommand1 = new MySqlCommand(sql1, sqlConnection);
MySqlDataReader sqlDataReader1 = sqlCommand1.ExecuteReader();
bool isExit = sqlDataReader1.HasRows;
if (isExit)
{
sqlDataReader1.Read(); // 必须先Read()
title_text = sqlDataReader1["title"].ToString();
abstract_text = sqlDataReader1["abstract"].ToString();
content_text = sqlDataReader1["content"].ToString();
category_name = sqlDataReader1["name"].ToString();
// 关闭连接
sqlDataReader1.Close();
}
else
{
MessageBox.Show("文章id错误。");
}
textBox_title.Text = title_text;
textBox_desc.Text = abstract_text;
richTextBox_content.Text = content_text;
comboBox_category.Text = category_name;
// 渲染文章分类
string sql2 = "select name from category where user_id = '" + DataShare.LoginUserId + "';";
MySqlCommand sqlCommand2 = new MySqlCommand(sql2, sqlConnection);
MySqlDataAdapter mysqlDataAdapter = new MySqlDataAdapter(sqlCommand2);
后面还有 197 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
