---恢复内容开始---

五道口 北大青鸟校区

KTV项目

指导老师: 袁玉明

 SQL数据库关系图

第一步:

  private void DoubleClicklvContry()
{
if (this.lvtype.SelectedItems[]!=null)
{
this.lvContry.Visible = true;
this.lvtype.Visible = false;
type = this.lvtype.SelectedItems[].Tag.ToString();
this.lvContry.Location = this.lvtype.Location;
lvContry.Dock = DockStyle.Fill;
}
string sql = "select singertype_id,singertype_name,singertype_imageURL from singer_type";
cmd = new SqlCommand(sql, con.Conntion);
try
{
con.OpenConntion();
SqlDataReader reader = cmd.ExecuteReader();
if (this.lvContry.Items != null)
{
lvSinger.Items.Clear();
}
if (reader.HasRows)
{
int index = ;
while (reader.Read())
{
ListViewItem item = new ListViewItem();
item.Text = reader[].ToString();
item.Tag = reader[].ToString();
this.imageList2.Images.Add(Image.FromFile(@"E:\KTV\SingerTypeIamge\" + reader[].ToString()));
item.ImageIndex =index;
this.lvContry.Items.Add(item);
index++;
}
}
reader.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.CloseConntion();
}
} 第二部:
private void lvtype_DoubleClick_1(object sender, EventArgs e)
{
DoubleClicklvContry();
}
/// <summary>
/// 给lvSinger添加数据
/// </summary>
private void DoubleClicklvSinger()
{
if (this.lvContry.SelectedItems[]!=null)
{
this.lvSinger.Visible = true;
this.lvContry.Visible = false;
this.lvSinger.Location = this.lvContry.Location;
this.lvSinger.Dock = DockStyle.Fill; string sql = string.Format("select singer_id,singer_name,singer_photo_url from singer_info where singer_sex='{0}' and singertype_id={1}",
type,Convert.ToInt32(this.lvContry.SelectedItems[].Tag));
cmd=new SqlCommand(sql,con.Conntion);
try
{
con.OpenConntion();
//imageList3.Images.Clear();
SqlDataReader reader = cmd.ExecuteReader();
if (this.lvSinger.Items!=null)
{
lvSinger.Items.Clear();
}
if (reader.HasRows)
{
int index = ;
while (reader.Read())
{
ListViewItem item = new ListViewItem();
item.Text = reader[].ToString();
item.Tag = reader[].ToString();
this.imageList3.Images.Add(Image.FromFile(@"E:\KTV\singerPhoto\" + reader[].ToString()));
item.ImageIndex = index;
this.lvSinger.Items.Add(item);
index++;
}
}
reader.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally {
con.CloseConntion();
}
}
}

104 第三部:  查找到该地区的歌手的歌曲

    private void lvContry_DoubleClick(object sender, EventArgs e)
{
DoubleClicklvSinger();
} private void DoubleClickSong()
{
if (this.lvSinger.SelectedItems[]!=null)
{
string sql = string.Format("select song_id,song_name,song_url,singer_name from song_info,singer_info"+
" where song_info.singer_id=singer_info.singer_id and singer_info.singer_id={0}",Convert.ToInt32(this.lvSinger.SelectedItems[].Tag));
FrmSong fs = new FrmSong();
fs.sql = sql; fs.Show();
this.Hide();
}

第四部:   选中歌手信息数据库连接↓

   private void FrmSong_Load(object sender, EventArgs e)
{ adapter = new SqlDataAdapter(sql, db.Conntion);
adapter.Fill(ds, "song_info"); this.dataGridView1.DataSource = ds.Tables["song_info"];
this.dataGridView1.AutoGenerateColumns = false;

以点歌曲传惨的列表

 public string Name { get; set; }
public string age { get; set; }
private void BOFANG_Load(object sender, EventArgs e)
{
this.listView1.Items.Clear();
foreach (Song item in ListSong.list)
{
ListViewItem lvitem = new ListViewItem(item.SongName);
lvitem.SubItems.Add(item.SongPath);
string sate = item.Sate == Sateze.unPaly ? "未播放" : "已播放";
lvitem.SubItems.Add(sate);
this.listView1.Items.Add(lvitem);

播放音乐原理图

第五部:  if 判定DATA 窗体传惨
传送到以点歌曲中
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
if (this.dataGridView1.SelectedRows[] != null)
{
BOFANG dd = new BOFANG();
Song song = new Song();
song.SongName = this.dataGridView1.SelectedRows[].Cells[].Value.ToString();
song.SongPath = this.dataGridView1.SelectedRows[].Cells[].Value.ToString();
dd.Name = song.SongName;
ListSong.AddSong(song); MessageBox.Show("添加成功,请在已点歌曲中查看!!!"); 第六步:拼音点歌 private void button1_Click(object sender, EventArgs e)
{
string en = textBox1.Text;
SqlConnection con = new SqlConnection(Sql.str);
string sql =string.Format( "select * from song_info where song_ab like '"+en+"%'");
SqlDataAdapter da = new SqlDataAdapter(sql,con);
DataSet ds = new DataSet(); da.Fill(ds, "song_info"); dataGridView1.DataSource = ds.Tables["song_info"];
SqlCommand cmd = new SqlCommand(sql,con);
try
{
con.Open();
int count = cmd.ExecuteNonQuery();
if (count > )
{
MessageBox.Show("查找成功");
} }
catch (Exception)
{ MessageBox.Show("网络异常请检查网络或者SQL 数据库!!!");
con.Close();

---恢复内容结束---

C# KTV 系统 SQL数据库连接 C# 应用窗体的更多相关文章

  1. SQL数据库连接到服务器出错——无法连接到XXX

    问题:Windows或者SQL Server身份验证下,出现连接到服务器出错 解决方式: 1.检查实例名称是否正确,如下 根据自己电脑的实际名称修改修改如下: 1)Microsoft SQL Serv ...

  2. Window系统、主函数和窗体函数这三者之间的关系

    理解Window系统.主窗体.窗体函数这三者之间的关系,对于编写Windows程序十分重要. 主函数和窗体函数都是由Windows系统来调用的函数.仅仅只是主函数是程序启动之后.系统首先调用的函数: ...

  3. SQL数据库连接池与C#关键字return

    SQL数据库连接池: 先前做的一个Sharepoint项目,在上线后的不久,最近一直出现间歇性访问缓慢问题Sharepoint特性问题,并分析了其数据库服务器,发现所耗内存已经达到了97%. 所以断定 ...

  4. KTV项目 SQL数据库的应用 结合C#应用窗体

    五道口北大青鸟校区 KTV项目 指导老师:袁玉明 歌曲播放原理 SQL数据库关系图 C#解决方案类图 第一步:创建数据库连接方法和打开方法和关闭方法! public class DBHelper { ...

  5. 仿5173游戏交易平台系统SQL注入(可直接脱裤)+Getshell

    最近没事登登好几年前玩过的游戏看看,发现有人喊高价收号,这一看就是骗子,这等骗子还想骗我?我就来看看这逗逼是怎么骗人的,结果发现这人给了一个说是 5173平台交易的网站,叫我直接把号的信息填上去然后填 ...

  6. web第一节课 sql 数据库连接 查询

    1.数据库连接语句 <connectionStrings> <add name="yhotel" connectionString="Database= ...

  7. SQL Server Window Function 窗体函数读书笔记二 - A Detailed Look at Window Functions

    这一章主要是介绍 窗体中的 Aggregate 函数, Rank 函数, Distribution 函数以及 Offset 函数. Window Aggregate 函数 Window Aggrega ...

  8. Java之MS SQL数据库连接

    一  1.首先,到微软官方下载jdbc驱动包 Microsoft JDBC Driver 4.0 for SQL Server 2.运行sqljdbc_4.0.2206.100_chs.exe,把文件 ...

  9. SQL Server Window Function 窗体函数读书笔记一 - SQL Windowing

    SQL Server 窗体函数主要用来处理由 OVER 子句定义的行集, 主要用来分析和处理 Running totals Moving averages Gaps and islands 先看一个简 ...

随机推荐

  1. sublime常用插件及配置,自留自用

    1.Angularjs 写angularjs经常操作template文件,没有一个ng-xx的提示真的很蛋疼是不是,有些服务的名字记不住是不是,那就用这个插件吧 2.AutoFileName 如果你的 ...

  2. 144 Binary Tree Preorder Traversal(二叉树先序遍历Medium)

    题目意思:二叉树先序遍历,结果存在vector<int>中 解题思路:1.递归(题目中说用递归做没什么意义,我也就贴贴代码吧) 2.迭代 迭代实现: class Solution { pu ...

  3. 一个用python实现的东方时尚(驾校)抢课程序

    2014-12-23 东方时尚约车还要网上选课,资源太紧张了,于是我决定自己写一个抢票程序来帮我刷票. 第一步,抓包.浏览器登陆选课系统,用抓包工具观察网络行为,这里我用的fildder.这里抓包主要 ...

  4. powerpoint取色器有什么用|ppt取色器使用教程

    在使用powerpoint过程中常常发现一些功能我们很少用到,其实是自己不会用的原因,关于powerpoint取色器有什么用呢?接下来我们一起来学一下ppt取色器使用教程. powerpoint取色器 ...

  5. Steps

    uva846:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  6. hdu GCD and LCM

    题意:gcd(a,b,c)=g; lcm(a,b,c)=l; 求出符合的a,b,c的所有情况有多少中. 思路:l/g=p1^x1*p2^x2*p3^x3.....;   x/g=p1^a1*p2^a2 ...

  7. Eclipse里的智能提示

    Eclipse 3.1里的智能提示功能对于写JAVA程序又不记得类名和函数的人来说是一个很好的助手工具,但是Eclipse里的智能提示的快捷键是Ctrl+Space,在中文Windows操作系统中它确 ...

  8. [项目构建 十三]babasport Nginx负载均衡的详细配置及使用案例详解.

    在这里再次说明下, 这个项目是从网上 找到的一套学习资料, 自己在 空闲时间学习了这些东西. 这里面的code当然会有很多不完善的地方, 但是确实也能学到很多新东西.感谢看过这一些列博文和评论的小伙伴 ...

  9. Android应用开发学习笔记之多线程与Handler消息处理机制

    作者:刘昊昱 博客:http://blog.csdn.net/liuhaoyutz 和JAVA一样,Android下我们可以通过创建一个Thread对象实现多线程.Thread类有多个构造函数,一般通 ...

  10. Floyd 算法 打印路径模板

    #include <iostream> #include <cstdlib> #include <cstdio> #include <algorithm> ...