初学ASP.NET, 询问个简单问题, LEFT , RIGHT, SUBSTRING这些函数没有吗?
- C# code
protected void txtJob_TextChanged(object sender, EventArgs e) { if (txtJob.Text.ToString().Trim() != "") { if (Left(txtJob.Text.ToString(),3) == "ECN") { } } }
怎么上面代码提示Left这个函数不存在??
[解决办法]
无需要有,Substring已经够用了
[解决办法]
string.isnullorempty
txtJob.Text.Substring
[解决办法]
引用 Microsoft.VisualBasic.dll
那些方法都有了
[解决办法]
return;
[解决办法]
这孩子是写asp出身的。
[解决办法]
SQL SERVIER 中 有 left 和 right
c# 中 只有 substring(startindex,length);
如果你要向用这2个函数可以自己 写。