asp.net中使用C#遇到的一个程序问题
这是一个在asp.net中用C#写的按钮功能
用意是将textValue赋与完整、动态的sql查询语句条件
可问题是在第二个switch中textValue没有被再次赋值(这是设断点的时候发现的),希望能得到您的帮助,万分感谢
private void Button1_Click(object sender, System.EventArgs e)
{
//创建一个字符串用于存放查询条件
string textValue="";
switch(this.DropDownList_timeStyle.SelectedValue) //设置断点后this.DropDownList_if.SelectedValue获取的值为:"月"
{
case "月":textValue = "select songInfor.歌曲编号,songInfor.歌曲名称,demandInfor.日期,demandInfor.月点击量 from demandInfor,songInfor where ";break;
case "年":textValue = "select songInfor.歌曲编号,songInfor.歌曲名称,sum(demandInfor.月点击量) 年点击量 from demandInfor,total,songInfor where ";break;
}
switch(this.DropDownList_if.SelectedValue) //设置断点后this.DropDownList_if.SelectedValue获取的值为:"歌曲编号"
{
case "歌曲编号":textValue += textValue + "songInfor.歌曲编号="+this.tbx_infor.Text+" and demandInfor.歌曲编号=songInfor.歌曲编号;";break;
case "歌曲名称":textValue += textValue + "songInfor.歌曲名称='"+this.tbx_infor.Text+"' and demandInfor.歌曲编号=songInfor.歌曲编号;";break;
}
}