コード例 #1
0
        private void FrmEditSong_Load(object sender, EventArgs e)
        {
            //绑定组合框
            db.BindComboBox(cmbSongType, "select * from song_type", "songtype_name", "songtype_id");
            if (song_id == 0)
            {
                return;
            }
            //添加信息到文本框中
            btnSave.Text = "保存修改";
            string  sql = string.Format("select song_name,song_ab,song_word_count,songtype_id,song_url,singer_name from dbo.song_info,singer_info where song_id = '{0}' and singer_info.singer_id = song_info.singer_id", song_id);
            DataSet ds  = db.GetDataSet(sql);

            txtSongName.Text = ds.Tables["temp"].Rows[0][0].ToString();

            txtPinYin.Text = ds.Tables["temp"].Rows[0][1].ToString();

            nudWordCount.Value = Convert.ToInt32(ds.Tables["temp"].Rows[0][2]);

            cmbSongType.SelectedValue = Convert.ToInt32(ds.Tables["temp"].Rows[0][3]);

            txtSongFileName.Text = ds.Tables["temp"].Rows[0][4].ToString();

            txtSinger.Text = ds.Tables["temp"].Rows[0][5].ToString();
        }
コード例 #2
0
        private void rdoCombination_Load(object sender, EventArgs e)
        {
            //性别默认选中男
            rdoMale.Checked = true;
            //绑定组合框
            db.BindComboBox(cmbSingerType, "select * from singer_type", "singertype_name", "singertype_id");
            //如果不是通过修改歌手信息启动的该窗体,就提前结束该方法
            if (singer_id == 0)
            {
                return;
            }
            btnAdd.Text = "修改";
            string sql = string.Format("select singer_name,singertype_id,singer_sex,singer_photo_url,singer_Describe from dbo.singer_info where singer_id = '{0}'", singer_id);
            //添加歌手信息到信息编辑框内
            DataSet ds = db.GetDataSet(sql);

            txtName.Text = ds.Tables["temp"].Rows[0][0].ToString();
            cmbSingerType.SelectedValue = Convert.ToInt32(ds.Tables["temp"].Rows[0][1]);
            switch (ds.Tables["temp"].Rows[0][2].ToString())
            {
            case "男":
                rdoMale.Checked = true;
                break;

            case "女":
                rdoFemale.Checked = true;
                break;

            case "组合":
                rdoCom.Checked = true;
                break;
            }
            photoPath = ds.Tables["temp"].Rows[0][3].ToString(); //写真图片的储存路径
            if (photoPath != string.Empty)                       //当路径不为空时
            {
                picSingerPhoto.Image = Image.FromFile(photoPath);
            }
            txtDescribe.Text = ds.Tables["temp"].Rows[0][4].ToString();
        }