添加数据怎么无法显示网页,数据也没有添加进数据库?

[复制链接]
查看11 | 回复1 | 2010-5-23 14:11:22 | 显示全部楼层 |阅读模式
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
public partial class backManage_addMusic : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)

{

}

protected void btClear_Click(object sender, EventArgs e)

{

tbMusicName.Text = "";

ddlType.SelectedIndex =-1;

ddlSinger.SelectedIndex = -1;

//ddlAlbum.SelectedItem.Text = "——请选择专辑名称——";

}

protected void btAdd_Click(object sender, EventArgs e)

{

if (Page.IsValid)

{

string strMusicName = tbMusicName.Text;

string strMusicAdd = @""+fuMusic.PostedFile.FileName;//自动识别转移字符

string strLyricAdd = fuLyric.PostedFile.FileName;

string strType = ddlType.SelectedItem.Text;

string strSinger = ddlSinger.SelectedItem.Text;

string strAlbum = ddlAlbum.SelectedItem.Text;

string strSpecialName = fuMusic.FileName;

string strSql1 = "insert into tb_musicInfo(musicName,musicPath,lyricPath,musicType,singerName,album,specialName) values('" + strMusicName + "','" + strMusicAdd + "','" + strLyricAdd + "','" + strType + "','" + strSinger + "','" + strAlbum + "','"+strSpecialName+"')";

string strSql2 = "select musicName from tb_musicInfo where musicName='"+strMusicName+"'";

if (dataOperate.getTier(strSql2)!=null)

{

Response.Write("");

}

else

{

try

{

if (dataOperate.execSql(strSql1))

{

Response.Write("");

}

}

catch (SqlException ex)

{

Response.Write(ex.Message);

}

}

}

}

protected void ddlSinger_TextChanged(object sender, EventArgs e)

{

ddlAlbum.Items.Clear();

string strSingerName = ddlSinger.SelectedItem.Text;

string strSql = "select albumName from tb_albumInfo where singer='" + strSingerName + "'";

SqlDataReader ds = dataOperate.getRow(strSql);

while (ds.Read())

{

ddlAlbum.Items.Add(ds["albumName"].ToString());

}

}
}

回复

使用道具 举报

千问 | 2010-5-23 14:11:22 | 显示全部楼层
最佳答案那是系统或程序出了问题,需要使用一些工具来修复。答案已发到窗口右上方“我的消息”里,请使用。挺管用的! 完后,效果不好的话,也可考虑系统还原一下(选好还原点)。 -------有人盗用答案 ,无奈只好用这种方式,请理解。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行