问答详情
源自:5-1 C#的声明数组和赋值

请老师帮我看看

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Common;

namespace WebApplication2
{
    public partial class Alter : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {

            }
            else
            {
                int id = Convert.ToInt32(Request.QueryString["id"]);
                SqlDataReader reader = DbHelperSQL.ExecuteReader("select * from Nows where id = " + id, null);
                NewObj obj = new NewObj();
                if (reader.Read())
                {
                    obj.ID = Convert.ToInt32(reader["ID"]);
                    obj.Type = Convert.ToInt32(reader["Type"]);
                    obj.Title = Convert.ToString(reader["Title"]);
                    obj.Addtime = Convert.ToDateTime(reader["Addtime"]);
                }

                textBoxID.Text = obj.ID.ToString();
                textBoxType.Text = obj.Type.ToString();
                textBoxTitle.Text = obj.Title;
                textBoxAdddatetime.Text = obj.Addtime.ToString();
                reader.Close();


            }
        }

        protected void btndelete_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(textBoxID.Text);
            string Title = textBoxTitle.Text;
            string datetime = textBoxAdddatetime.Text;
            int type = Convert.ToInt32(textBoxType.Text);
            DbHelperSQL.ExecuteSql("delete  Nows  where ID=" + id);
        }
    }
}


提问者:qq_夏夏_1 2016-07-18 22:42

个回答

  • 慕粉18826418863
    2016-07-20 19:05:34

    这问的是什么,代码太长,没心思看