在以下代码中:DWDM是数字,SEX是中文,因此第二个if就报错,怎样改一下?
protected void SqlDataSource3_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandText += " where 1 = 1 ";
if (DropDownList1.SelectedValue != "0")
e.Command.CommandText += " and DWDM = " + DropDownList1.SelectedValue;
if (DropDownList2.SelectedValue != "0")
e.Command.CommandText += " and SEX = " + DropDownList2.SelectedValue; }
protected void SqlDataSource3_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandText += " where 1 = 1 ";
if (DropDownList1.SelectedValue != "0")
e.Command.CommandText += " and DWDM = " + DropDownList1.SelectedValue;
if (DropDownList2.SelectedValue != "0")
e.Command.CommandText += " and SEX = " + DropDownList2.SelectedValue; }
protected void SqlDataSource3_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandText += " where 1 = 1 ";
if (DropDownList1.SelectedValue != "0")
e.Command.CommandText += " and DWDM = ' " + DropDownList1.SelectedValue + " ' ";
if (DropDownList2.SelectedValue != "0")
e.Command.CommandText += " and SEX = ' " + DropDownList2.SelectedValue + " ' "; }