1.string h1="0401";
  string h2="0451";
  if (h1<h2)
     {....}
  这样比较会出错,如何比较字符串的大小2.修改 DataSet 中的数据出错
  DataSet DA_SPDJ=new DataSet();
  SqlDataAdapter Dapt_SPDJ=new SqlDataAdapter("SELECT Field_F FROM SPDJ", Conn1);
  Dapt_SPDJ.Fill(DA_SPDJ, "SPDJ");
  DataTable TA_SPDJ=DA_SPDJ.Tables["SPDJ"];
  TA_SPDJ.Rows(1)(Field_F)=1000;          //修改,语句有错

解决方案 »

  1.   

    1)使用String对象的CompareTo方法:
        private static string CompareStrings( string str1, string str2 ) {        // compare the values, using the CompareTo method on the first string
            int cmpVal = str1.CompareTo(str2);    if (cmpVal == 0) // the values are the same
                return "The strings have the same value!";        else if (cmpVal > 0) // the first value is greater than the second value
                return "The first string is greater than the second string!";
                
            else // the second string is greater than the first string
                return "The second string is greater than the first string!";
        }
    }
      

  2.   

    应该为:TA_SPDJ.Rows[行序号][字段序号] = 1000
      

  3.   

    TA_SPDJ.Rows[1]["Field_F"]=1000;  //类型需要一致
      

  4.   

    Field_F是数字来的,连编译说:"System.Data.DataTable.Rows"表示"属性",此处应为"方法"
      

  5.   

    这是VB还是C#?1、if( int.Parse(h1) < int.Parse(h2) )
      

  6.   

    1.string h1="0401";
      string h2="0451";
      if (h1<h2)
         {....}
      这样比较会出错,如何比较字符串的大小
    是不是比较两个字符串的长度啊,如果是的话,不是可以用
    h1.length < h2.length  吗
    如果是比较两个数的大小的话
    不是可以用Int32.parse(h1) < Int32.parse(h2)吗
      

  7.   

    string.Compare(str1,str2);就可以了!!!!!!!!!!
      

  8.   

    TA_SPDJ.Rows[1][Field_F] = 1000;