this.Lab2.Text = DDST.Rows[0]["Price_Yue"].ToString().Trim();Price_Yue中获取的是“2009年”、“09月”这样的值,有什么方法可以把中文去掉呢?

解决方案 »

  1.   

    this.Lab2.Text = DDST.Rows[0]["Price_Yue"].Format("YYYY-MM-DD");
      

  2.   

    DDST.Rows[0]["Price_Yue"].ToString().Substring(0,4)
      

  3.   

    这个可以
    你也可以
    string str=DDST.Rows[0]["Price_Yue"].ToString().Trim();
    this.Lab2.Text = str.Replace("年","-").Replace("月","-");
      

  4.   

    Replace("年","-").Replace("月","-");
    或使用DateTime dt = DateTime.ParseExact("", "yyyy-MM-dd HH:mm:ss" CultureInfo.InvariantCulture); 
      

  5.   

    取前4个字符,DDST.Rows[0]["Price_Yue"].ToString().Substring(0,4)这个就可以了//有些问题:Price_Yue就是什么年或什么月么?你想把它转成什么形式?
      

  6.   

    首先要明白Price_Yue中的值是什么类型,是什么样子.