//加载文章类型的信息
    public void ST_Type_List_Bind()
    {
        string sqlstr = "select * from ST_class order by ST_date desc ";

        //调用公共类中的ExceDS()方法,用来返回一个DataSet类型
        My_sqldata.ExceDS(sqlstr);
        //获取数据表中的主键字段
        ClassList.DataKeyNames = new string[] { "ST_c_id" };
        ClassList.DataSource   = My_sqldata.ExceDS(sqlstr);
        ClassList.DataBind();
    }
Beispiel #2
0
        public void Add(TextBox a1, TextBox a2, TextBox a3, TextBox a4, TextBox a5,
                        TextBox a6, TextBox a7, TextBox a8,
                        ComboBox b1, ComboBox b2, ComboBox b3, ComboBox b4, ComboBox b5,
                        ComboBox b6, ComboBox b7)
        {
            try
            {
                string sqlcmdProvince = "select ProvinceID from [S_Province] where [ProvinceName]='" + b5.Text.ToString().Trim() + " '";
                string sqlcmdCity     = "select CityID from [S_City] where [CityName]='" + b6.Text.ToString().Trim() + " '";
                string sqlcmdDistrict = "select DistrictID from [S_District] where [DistrictName]='" + b7.Text.ToString().Trim() + " '";

                DataSet ds1 = sqlda.ExceDS(sqlcmdProvince);
                DataSet ds2 = sqlda.ExceDS(sqlcmdCity);
                DataSet ds3 = sqlda.ExceDS(sqlcmdDistrict);

                int pp = 0, cc = 0, dd = 0;

                if (ds1.Tables[0].Rows.Count > 0)
                {
                    pp = Convert.ToInt32(ds1.Tables[0].Rows[0]["ProvinceID"].ToString().Trim());
                }
                if (ds2.Tables[0].Rows.Count > 0)
                {
                    cc = Convert.ToInt32(ds2.Tables[0].Rows[0]["CityID"].ToString().Trim());
                }
                if (ds3.Tables[0].Rows.Count > 0)
                {
                    dd = Convert.ToInt32(ds3.Tables[0].Rows[0]["DistrictID"].ToString().Trim());
                }

                //DateTime dt = Convert.ToDateTime("1998-10-25");

                DateTime dt    = Convert.ToDateTime(b2.Text.ToString() + "-" + b3.Text.ToString() + "-" + b4.Text.ToString());
                string   zd    = "cName,cSex,cBirth,cMobile,cTel,cShortM,cQQ,cEmail,cWeiXin,cAddProId,cAddCityId,cAddAreaId,cAddDetail";
                string   value = "'" + a1.Text.ToString().Trim() + "','" + b1.Text.ToString().Trim() + "','" + dt.ToString().Trim() + "','" + a2.Text.ToString().Trim() + "','" + a3.Text.ToString().Trim() + "'," +
                                 "'" + a4.Text.ToString().Trim() + "' ,'" + a5.Text.ToString().Trim() + "','" + a6.Text.ToString().Trim() + "','" + a7.Text.ToString().Trim() + "','" + pp.ToString().Trim() + "'," +
                                 "'" + cc.ToString().Trim() + "','" + dd.ToString().Trim() + "','" + a8.Text.ToString().Trim() + "'";

                string sqlcmd = "insert into contractBaseInformation(" + zd + ") values(" + value + ")";
                sqlda.ExceDS(sqlcmd);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("数据库异常,请稍后尝试!");
            }
            finally
            {
            }
        }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null)
        {
            Response.Redirect("~/BlogIndex.aspx");
        }
        SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);

        mycon.Open();
        DataSet        mydataset     = new DataSet();
        SqlDataAdapter mydataadapter =
            new SqlDataAdapter("select * from tb_Blog where UserName='******'", mycon);

        //SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog", mycon);
        mydataadapter.Fill(mydataset, "tb_Blog");
        DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0];

        ID = rowview["BlogID"].ToString();
        SqlData da = new SqlData();

        GridView1.DataSource = da.ExceDS("select * from tb_Message where BlogID='" + ID + "'");
        //this.GridView1.DataSource = da.ExceDS("select * from tb_Message where BlogID='"+ID+"'");
        GridView1.DataKeyNames = new[] { "MessageID" };
        GridView1.DataBind();
    }
Beispiel #4
0
        private Boolean login(TextBox txtUserName, TextBox txtUserPd)
        {
            if (!txtCheck("login"))
            {
                MessageBox.Show("账号或密码不得为空,请输入账号密码", "登录错误");; return(false);
            }
            else
            {
                string user     = txtUserName.Text.Trim();
                string Password = txtUserPd.Text.Trim();
                string yz       = "select * from contractUser where userName='******' and userPd='" + Password + "'";

                DataSet sd = tools.ExceDS(yz);
                if (sd.Tables[0].Rows.Count >= 1)
                {
                    return(true);
                }
                else
                {
                    MessageBox.Show("您的用户名或密码错误,请输入正确的账号密码", "验证错误", MessageBoxButtons.OK);
                    txtUserPd.Clear();
                    return(false);
                }
            }
        }//登录验证功能
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlData da = new SqlData();
        DataSet ds = da.ExceDS("select top 5 * from tb_Href order by HrefID Desc");

        this.DataList1.DataSource = ds;
        this.DataList1.DataBind();
    }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlData da = new SqlData();

        gvBlog.DataSource   = da.ExceDS("select * from tb_Blog");
        gvBlog.DataKeyNames = new[] { "BlogID" };
        gvBlog.DataBind();
    }
        private void ST_Link_Bind()
        {
            string ST_sql = "select * from ST_message order by ST_mdate desc";

            //调用公共类中的ExceDS方法,执行查询语句
            MessageList.DataSource   = sd.ExceDS(ST_sql);
            MessageList.DataKeyNames = new string[] { "ST_id" };
            this.MessageList.DataBind();
        }
Beispiel #8
0
        private void ST_Replay_Bind()
        {
            string ST_sql = "select * from ST_replay";

            //调用公共类SqlData中的ExceDS方法,返回一个DataSet类型的数据集
            ReplayList.DataSource   = sd.ExceDS(ST_sql);
            ReplayList.DataKeyNames = new[] { "ST_r_id" };
            ReplayList.DataBind();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string  blog = Page.Request["BlogID"];
        SqlData da   = new SqlData();
        DataSet ds   = da.ExceDS("select * from tb_Article where BlogID='" + blog + "'");

        this.DataList1.DataSource = ds;
        this.DataList1.DataBind();
    }
Beispiel #10
0
    public void ST_Article_Bind()
    {
        string sqlstr = "select * from ST_news where BlogID='" + ID + "'";

        //调用公共类中的ExceDS方法,返回一个DataSet类型的数据集,并作为GridView控件的数据源
        GridView1.DataSource   = da.ExceDS(sqlstr);
        GridView1.DataKeyNames = new string[] { "ST_n_id" };
        GridView1.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        /*判断是否登录*/
        ST_check_Login();
        SqlData da = new SqlData();

        //调用公共类中的ExceDS方法执行SQL语句
        GridView1.DataSource   = da.ExceDS("select * from ST_link");
        GridView1.DataKeyNames = new[] { "ST_l_id" };
        GridView1.DataBind();
    }
Beispiel #12
0
        public void pdModify()
        {
            string user    = u_tb.Text.Trim();
            string oldpass = old_pass.Text.Trim();
            string newpass = new_pass.Text.Trim();

            string lookintoUser = "******" + user + "'";
            string lookintoPass = "******" + user + "' and userPd = '" + oldpass + "'";

            DataSet lkuser = tools.ExceDS(lookintoUser);
            DataSet lkpass = tools.ExceDS(lookintoPass);

            if (lkuser.Tables[0].Rows.Count <= 0)    //验证用户名是否存在
            {
                MessageBox.Show("您输入的账户有误,请输入正确的账户", "账号错误");
            }
            else if (lkpass.Tables[0].Rows.Count <= 0)    //验证密码是否正确
            {
                MessageBox.Show("您输入的密码有误,请核对后重新输入密码", "密码错误");
                old_pass.Clear();
            }
            else if (oldpass == newpass)    //验证新旧密码不能相同
            {
                MessageBox.Show("新密码不能与旧密码相同", "密码错误");
                new_pass.Clear();
                new_pass2.Clear();
            }
            else if (new_pass.Text.Trim() != new_pass2.Text.Trim())    //验证重复密码与新密码相同
            {
                MessageBox.Show("重复密码与新密码不相同,请重新输入", "新密码出错");
            }
            else    //修改密码功能
            {
                string revisePass = "******" + newpass + "' where userName='******'";
                tools.ExecuteNonQuery(revisePass);
                MessageBox.Show("恭喜你,密码更改成功\n正在跳转前往登录界面。。。。", "更改成功");
                frmLogin f = new frmLogin();
                f.Show();
                this.Close();
            }
        }
    public void ST_Article_Bind()
    {
        //根据获取的用户ID查询其所有文章
        string sqlstr = "select * from ST_news where BlogID='" + ID + "'";

        //调用公共类中的ExceDS方法,返回一个DataSet类型的数据集,并作为GridView控件的数据源
        GridView1.DataSource = da.ExceDS(sqlstr);
        //获取GridView控件中的主键字段
        GridView1.DataKeyNames = new string[] { "ST_n_id" };
        //从数据库中绑定数据到列表控件中
        GridView1.DataBind();
    }
Beispiel #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserName"] == null)
        {
            Response.Redirect("../../Index.aspx");
        }
        SqlData da = new SqlData();

        this.GridView1.DataSource = da.ExceDS("select * from tb_Href");
        GridView1.DataKeyNames    = new string[] { "HrefID" };
        GridView1.DataBind();
    }
Beispiel #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //if (Session["UserName"] == null)
         //{
         //    Response.Redirect("../../Index.aspx");
         //}
         SqlData da = new SqlData();
         this.gvAdmin.DataSource = da.ExceDS("select * from tb_Admin");
         gvAdmin.DataKeyNames    = new string[] { "id" };
         gvAdmin.DataBind();
     }
 }
Beispiel #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserName"] == null)
     {
         Response.Redirect("../../Index.aspx");
     }
     else
     {
         SqlData da = new SqlData();
         this.gvBlog.DataSource = da.ExceDS("select * from tb_Blog");
         gvBlog.DataKeyNames    = new string[] { "BlogID" };
         gvBlog.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //if (Session["UserName"] == null)
         //{
         //    Response.Redirect("../../Index.aspx");
         //}
         SqlData da = new SqlData();
         this.gvAdmin.DataSource = da.ExceDS("select * from tb_Admin");
         gvAdmin.DataKeyNames = new string[] { "id" };
         gvAdmin.DataBind();
     }
 }
Beispiel #18
0
 //绑定数据视图
 public void Bin_dataGridView()
 {
     try
     {
         string  sqlcmd = "select * from contractBaseInformation";
         DataSet ds     = sqlda.ExceDS(sqlcmd);
         dataGridView1.DataSource = ds.Tables[0];
         changeHeader();
     }
     catch (SqlException ex)
     {
         MessageBox.Show("数据库异常,请稍后尝试!");
     }
     finally
     {
     }
 }
Beispiel #19
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         username = user_tb.Text.Trim();
         string  cha = "select * from contractUser where userName='******'";
         DataSet ds  = tools.ExceDS(cha);
         if (user_tb.Text.Length <= 0 || pass_tb.Text.Length <= 0 || pass_tb2.Text.Length <= 0)//检查用户名密码是否为空
         {
             MessageBox.Show("用户名或密码不可为空,请重新输入", "用户名密码不可为空");
         }
         else if (user_tb.Text.Length < 6 || pass_tb.Text.Length < 6 || pass_tb2.Text.Length < 6)
         {
             MessageBox.Show("用户名密码需要大于六个字符,请重新输入用户名密码", "注册错误"); //检查用户名密码是否小于六个字符
         }
         else if (ds.Tables[0].Rows.Count >= 0)                   //验证用户名是否重复
         {
             MessageBox.Show("用户名已被注册,请更改用户名", "注册失败", MessageBoxButtons.OK);
         }
         else if (password1 != password2)//验证重复密码和密码是否相同
         {
             MessageBox.Show("两次密码不相同,请重新输入密码", "注册失败", MessageBoxButtons.OK);
             pass_tb.Clear();
             pass_tb2.Clear();
         }
         else//向数据库添加数据,即注册功能
         {
             string zc = "insert into contractUser (userName,userMiMa) values ('" + username + "','" + password1 + "')";
             tools.ExecuteNonQuery(zc);
             MessageBox.Show("恭喜你注册账号成功\n正在进行跳转,请稍后。。。。");
             this.Hide();
             frmLogin f = new frmLogin();
             f.Show();
         }
     }
     catch (SqlException ex)
     {
         MessageBox.Show("系统错误,请稍后再试", "系统错误");
     }
     finally
     {
     }
 }//注册功能
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["UserName"] == null)
     {
         Response.Redirect("~/BlogIndex.aspx");
     }
     SqlConnection mycon = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
     mycon.Open();
     DataSet mydataset = new DataSet();
     SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog where UserName='******'", mycon);
     //SqlDataAdapter mydataadapter = new SqlDataAdapter("select * from tb_Blog", mycon);
     mydataadapter.Fill(mydataset, "tb_Blog");
     DataRowView rowview = mydataset.Tables["tb_Blog"].DefaultView[0];
     ID = rowview["BlogID"].ToString();
     SqlData da = new SqlData();
     this.GridView1.DataSource = da.ExceDS("select * from tb_Message where BlogID='" + ID + "'");
     //this.GridView1.DataSource = da.ExceDS("select * from tb_Message where BlogID='"+ID+"'");
     GridView1.DataKeyNames = new string[] { "MessageID" };
     GridView1.DataBind();
 }
Beispiel #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            string  user     = user_tb.Text.Trim();
            string  pass     = pass_tb.Text.Trim();
            string  lookinto = "select * from contractUser where userName='******' and userMiMa = '" + pass + "'";
            DataSet lkinto   = tools.ExceDS(lookinto);

            if (lkinto.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show("您的账号或密码有误,请查验后在试", "错误");
            }
            else
            {
                DialogResult TorF = MessageBox.Show("您真的要注销账户吗???(注销账户后,一切资料将丢失)", "请确认", MessageBoxButtons.OKCancel);
                if (TorF == DialogResult.OK)
                {
                    string del = "delete from contractUser where userName='******' and userMiMa = '" + pass + "'";
                    tools.ExecuteNonQuery(del);
                    MessageBox.Show("您的账号已注销", "注销成功");
                }
            }
        }
Beispiel #22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     /*判断是否登录*/
     ST_check_Login();
     SqlData da = new SqlData();
     //调用公共类中的ExceDS方法执行SQL语句
     this.GridView1.DataSource = da.ExceDS("select * from ST_link");
     GridView1.DataKeyNames = new string[] { "ST_l_id" };
     GridView1.DataBind();
 }