see.aspx?id=369在 see.aspx.cs 代码中我想这样做:string getid = Request.query["id"];if(getid 是正整数) // 如何判断 getid 是正整数呢
{
do something .....
}
else
{
do otherthing .....}
{
do something .....
}
else
{
do otherthing .....}
{
int n = 0;
try
{
n = int.Parse(Value);
}
catch
{
}
return n;
}
调用它做判断就可以了
public static int CvtInt(string Value)
{
int n = 0;
try
{
return n = int.Parse(Value);
}
catch
{
return 0;
}
}我觉得这样比较好些
{
try
{
return int.Parse(Value);
}
catch
{
return 0;
}
}
//这个是VB中的函数,可以用来直接判断,你添加引用即可使用
//这个是VB中的函数,可以用来直接判断,你添加引用即可使用
----------