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; //修改,语句有错
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; //修改,语句有错
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!";
}
}
string h2="0451";
if (h1<h2)
{....}
这样比较会出错,如何比较字符串的大小
是不是比较两个字符串的长度啊,如果是的话,不是可以用
h1.length < h2.length 吗
如果是比较两个数的大小的话
不是可以用Int32.parse(h1) < Int32.parse(h2)吗