开发者

error when selected value from ddl

I had DDL and when I selected on it this error apear (operator < cannot be aplied with operand String or int )

 if (DDlCity.SelectedValue < 0)
        {
            using (SqlConnection con = Connection.GetConnection())
            {
                SqlCommand Com = new SqlCommand("GetDealers", con);
                Com.CommandType = CommandType.StoredProcedure;

            SqlDataAdapter DA = new SqlDataAd开发者_JS百科apter(Com);
            DA.Fill(DT);
            GridView1.DataSource = DT;
            GridView1.DataBind();
        }


You need to convert DDlCity.SelectedValue to an appropriate type - it sounds like it's currently string. You'll need to parse it, e.g. with int.TryParse or int.Parse.


if (DDlCity.SelectedIndex<0)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜