//首先要查出数据库中的图片路径和歌曲路径
private void FrmCountry_Load(object sender, EventArgs e)
{
con = new SqlConnection(connectionStr);
con.Open();
string sql = "select resource_path from resource_path where resource_id= ";
string sqlsongpath = "select resource_path from resource_path where resource_id= ";
SqlCommand cmd = new SqlCommand(sql,con);
SqlCommand cmd = new SqlCommand(sqlsongpath, con);
KtvUnit.ImagePath = cmd.ExecuteScalar().ToString();
KtvUnit.SongPath = cmd .ExecuteScalar().ToString();
con.Close();
}
//点击歌手男女或组合时
private void LvOne_Click(object sender, EventArgs e)
{
LoadSingerArea();
}
public string singer_type { get; set; }
private void LoadSingerArea()
{
if (this.LvOne.SelectedItems[ ] != null)
{
LvOne.Visible = false;
LvTwo.Location = LvOne.Location;
LvTwo.Dock = DockStyle.Fill;
LvTwo.Visible = true;
this.singer_type=Convert.ToString(LvOne.SelectedItems[ ].Text);
}
con = new SqlConnection(connectionStr);
string sql = "select singertype_id,singertype_name from singer_type";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader dr;
try
{
con.Open();
LvTwo.Items.Clear();
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
int index = ;
while (dr.Read())
{
ListViewItem lvItem = new ListViewItem();
int typeid = Convert.ToInt (dr["singertype_id"]);
string typename = Convert.ToString(dr["singertype_name"]);
lvItem.Text = typename;
lvItem.Tag = typeid;
lvItem.ImageIndex = index;
LvTwo.Items.Add(lvItem);
index++;
}