编译器错误信息: CS0029: 无法将类型“int”隐式转换为“string”,请高手啊.
编译器错误信息: CS0029: 无法将类型“int”隐式转换为“string”
源错误:
行 39: switch (typeText)
行 40: {
行 41: case 1: typeText == 17;
行 42: sqlTemp += " and 17 ";
行 43: break;
源文件: e:\n\3CMarket\newsList.aspx.cs 行: 41
发生错误的.cs页代码如下:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class newsList : System.Web.UI.Page
{
string sqlTemp = "Where 1=1 ";
//string typeText = Convert.ToInt16(Request.QueryString[ "TypeID "]);
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[ "tontelConn "].ToString());
protected void Page_Load(object sender, EventArgs e)
{
string typeText = Request.QueryString[ "TypeID "].ToString();
SqlDataAdapter sda = new SqlDataAdapter( "Select ID,Title,Type,CreateDate From TC_News Where Type= ' "+typeText+ " ' Order By CreateDate Desc ", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
Repeater1.DataSource = ds.Tables[0];
//以下部分到 this.DataBind(sqlTemp)有问题.我的想法是:当获取不同的URL参数就会显示相应类型的新闻.
//if(typeText== "17 ")
//{ sqlTemp += " and 17 "; }
//if(typeText== "34 ")
//{ sqlTemp += " and 34 "; }
//if (typeText == "35 ")