//设置歌手写真路径 private void tsmiSingerPhotoPath_Click(object sender, EventArgs e) { FrmSongPath frmSongPath = new FrmSongPath(); string singer_photo_url = new MyKTV_.DBHelper().ExecuteScalar("select singer_photo_url from singer_info").ToString(); frmSongPath.singer_photo_path = singer_photo_url.Substring(0, singer_photo_url.Length - singer_photo_url.Substring(singer_photo_url.LastIndexOf("\\")).Length + 1); frmSongPath.Show(); }
/// <summary> /// 设置歌曲路径 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsmiSongPath_Click(object sender, EventArgs e) { FrmSongPath frmSongPath = new FrmSongPath(); string songPath = new MyKTV_.DBHelper().ExecuteScalar("select song_url from song_info").ToString(); int songPathLength = songPath.Length; //路径总长度 int filePathLength = songPath.Substring(songPath.LastIndexOf("\\")).Length; //文件名长度 frmSongPath.song_path = songPath.Substring(0, songPathLength - filePathLength + 1); //去掉文件名后的路径 frmSongPath.Show(); }
public void GetDataView() { //查询全部歌手信息 string sql = "select s_t.singerType_id,s_i.singer_id,singer_name,singer_sex,singertype_name,singer_photo_url,singer_Describe from singer_info s_i inner join singer_type s_t on s_i.singertype_id = s_t.singertype_id"; DataSet ds = new MyKTV_.DBHelper().GetDataSet(sql); //使用DataTable对象生成DataView视图对象 dv = ds.Tables["temp"].DefaultView; //绑定DataGridView数据源 dgvSingerList.DataSource = dv; }