日期:2014-05-18 浏览次数:22157 次
private void SaveSongInfo() { int songWordCount = this.txtSongName.Text.Length; StringBuilder sb = new StringBuilder(); #region 判定窗体类型,确定是修改或者新增 /*新增歌曲信息*/ if (frmType.Equals("addSong")) { sb.AppendLine("insert song_info(song_name,song_ab,song_word_count,songtype_id,singer_id,song_url,song_play_count)"); sb.AppendFormat("values('{0}','{1}',{2},{3},{4},'{5}',default)", txtSongName.Text, txtSpell.Text, songWordCount, cboSongType.SelectedValue, singerId, txtSongFileName.Text); } /*修改歌曲信息SQL语句*/ else if (frmType.Equals("updateSong")) { } #endregion SqlCommand command = new SqlCommand(sql, DBHelper.conn); try { DBHelper.conn.Open(); int ret = (int)command.ExecuteNonQuery(); if (ret >= 0) { MessageBox.Show("保存成功", "提示"); } else { MessageBox.Show("保存失败", "提示"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "提示"); } finally { DBHelper.conn.Close(); }