//private string modgcode2; //private string modscode2; //private string modacode2; //private string modtrack2; //private string adduser; public Form12() { InitializeComponent(); using (sqlAdapter sqladp = new sqlAdapter()) { DataSet ds2; sqladp.getDataSet("select distinct acode from [album]", out ds2); for (int i = 0; i < ds2.Tables[0].Rows.Count; i++) { comboBox2.Items.Add(ds2.Tables[0].Rows[i][0]); } comboBox2.SelectedIndex = 0; } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { comboBox2.Items.Clear(); using (sqlAdapter sqladp = new sqlAdapter()) { DataSet ds; sqladp.getDataSet("select autho from [user] where username='******'", out ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { comboBox2.Items.Add(ds.Tables[0].Rows[i][0]); } comboBox2.SelectedIndex = 0; } }
//private string username; //private string autho; public Form10() { InitializeComponent(); using (sqlAdapter sqladp = new sqlAdapter()) { DataSet ds; sqladp.getDataSet("select distinct username from [user]", out ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { comboBox1.Items.Add(ds.Tables[0].Rows[i][0]); } comboBox1.SelectedIndex = 0; } }
private void comboBox6_SelectedIndexChanged(object sender, EventArgs e) { comboBox7.Items.Clear(); comboBox8.Items.Clear(); comboBox10.Items.Clear(); comboBox11.Items.Clear(); comboBox12.Items.Clear(); comboBox9.Items.Clear(); modtrack = comboBox6.Text; modscode = modacode + modtrack; List<DataTable> dt; List<ComboBox> CB = new List<ComboBox>(6); CB.Add(comboBox7); CB.Add(comboBox8); CB.Add(comboBox9); CB.Add(comboBox10); CB.Add(comboBox11); CB.Add(comboBox12); DataSet modOrigin = new DataSet(); try { using (sqlAdapter sqladp = new sqlAdapter()) { sqladp.getDataSet("select origin from [ori],song where ori.oricode=song.oricode and scode='" + modscode + "'",out modOrigin); modorigin = modOrigin.Tables[0].Rows[0][0].ToString(); sqladp.getDataTables(out dt, "select lyric from [song] where scode='" + modscode + "'", "select sname from [song] where scode='" + modscode + "'", "select arranger from [song] where scode='" + modscode + "'", "select style from [song] where scode='" + modscode + "'", "select vocal from [song] where scode='" + modscode + "'", "select distinct origin from [ori]"); string sql = "select oricode from [ori] where origin = '" + modorigin + "'"; modoricode = sqladp.ExecuteScalar(sql) as string; } Program.fillIn(ref dt, ref CB); comboBox12.SelectedIndex = comboBox12.Items.IndexOf(modorigin); } catch(Exception) { MessageBox.Show("无此曲目", "提示"); } }
//private void connectSQL() //{ // conn = new SqlConnection(DataPool.conString); // conn.Open(); //} //private void closeSQL() //{ // conn.Close(); //} private void button1_Click(object sender, EventArgs e) { // pictureBox2.Image = null; tempgname = textBox1.Text.Replace("'", "''"); tempaname = textBox2.Text.Replace("'", "''"); tempsname = textBox3.Text.Replace("'", "''"); temparranger = textBox5.Text.Replace("'", "''"); templyric = textBox4.Text.Replace("'", "''"); tempvocal = textBox9.Text.Replace("'", "''"); tempstyle = textBox8.Text.Replace("'", "''"); temptime = textBox7.Text; temporigin = comboBox1.Text; sqlstr = "select [group].gname as 社团名,album.aname as 专辑名,[time] as 首发展会,track as 音轨号,sname as 曲目名,arranger as 编曲,lyric as 作词,vocal as 歌手,style as 风格,origin as 原曲,adduser as 添加人员 from album,gas,[group],ori,song where gas.gcode=[group].gcode and gas.acode=album.acode and gas.scode=song.scode and song.oricode=ori.oricode"; if (tempgname != string.Empty) sqlstr = sqlstr + " and [group].gname like '%" + tempgname + "%'"; if (tempaname != string.Empty) sqlstr = sqlstr + " and album.aname like '%" + tempaname + "%'"; if (tempsname != string.Empty) sqlstr = sqlstr + " and song.sname like '%" + tempsname + "%'"; if (temparranger != string.Empty) sqlstr = sqlstr + " and arranger like '%" + temparranger + "%'"; if (templyric != string.Empty) sqlstr = sqlstr + " and lyric like '%" + templyric + "%'"; if (tempvocal != string.Empty) sqlstr = sqlstr + " and vocal like '%" + tempvocal + "%'"; if (tempstyle != string.Empty) sqlstr = sqlstr + " and style like '%" + tempstyle + "%'"; if (temptime != string.Empty) sqlstr = sqlstr + " and time like '%" + temptime + "%'"; if (temporigin != string.Empty) sqlstr = sqlstr + " and origin='" + temporigin + "'"; DataSet ds1; using (sqlAdapter sqladp = new sqlAdapter()) { sqladp.getDataSet(sqlstr, out ds1, "detail"); } // Trace.WriteLine(ds.Tables[0].Rows.Count); dataGridView1.DataSource = ds1.Tables[0]; // for (int i = 0; i < ds.Tables[0].Rows.Count; i++) // { // dataGridView1. //comboBox1.Items.Add(ds.Tables[0].Rows[i][0]); // } // comboBox1.SelectedIndex = 0; /* byte[] imagebytes = null; connectSQL(); SqlCommand com = new SqlCommand("select cover from album where aname='"+tempaname+"'", conn); //" + tempaname + " SqlDataReader dr = com.ExecuteReader(); while (dr.Read()) { imagebytes = (byte[])dr.GetValue(0); } dr.Close(); com.Clone(); if (imagebytes != null) { MemoryStream ms = new MemoryStream(imagebytes); Bitmap bmpt = new Bitmap(ms); //Image image = Image.FromStream(ms, true); dr.Close(); closeSQL(); pictureBox2.Image = bmpt; }*/ }
private void Form2_Load(object sender, EventArgs e) { Form1 Form1 = new Form1(); Form1.ShowDialog(); if (!Form1.IsDisposed) return; //if (DataPool.currentID == "") // return; using (sqlAdapter sqladp = new sqlAdapter()) { string sql = "select count(scode) from gas "; int ssum = Convert.ToUInt16(sqladp.ExecuteScalar(sql)); toolStripStatusLabel1.Text = "目前歌曲数:" + ssum; sql = "select count(username) from [user] "; int peoplesum = Convert.ToUInt16(sqladp.ExecuteScalar(sql)); toolStripStatusLabel3.Text = "注册人数:" + peoplesum; sql = "select autho from [user] where username = '******'"; string autho = sqladp.ExecuteScalar(sql) as string; DataPool.currentAutho = autho; switch (autho) { case "3": 添加原曲ToolStripMenuItem.Enabled = false; 添加ToolStripMenuItem.Enabled = false; 删除ToolStripMenuItem.Enabled = false; 修改ToolStripMenuItem.Enabled = false; break; case "2": 删除ToolStripMenuItem.Enabled = false; 修改ToolStripMenuItem.Enabled = false; break; } DataSet ds; sqladp.getDataSet("SELECT origin FROM ori",out ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { comboBox1.Items.Add(ds.Tables[0].Rows[i][0]); } comboBox1.SelectedIndex = 0; } // clerkNameText.Text = "当前管理员 " + DataPool.currentID; // statusStrip1.Items.Insert(1, new ToolStripSeparator()); }