我对使用ASP.NET和VB.NET中的+和&存在一些困惑。请看下面的代码:在asp.net中使用&和+ vb
Dim dtUser As DataTable = GetDetails()
Dim serverPath As String = Nothing
Dim virtualServerPath As String = Nothing
Dim parentDir As DirectoryInfo = Nothing
Dim childDir As DirectoryInfo = Nothing
serverPath = Page.Server.MapPath(".") + "\"
virtualServerPath = serverPath.Substring(0, serverPath.LastIndexOf("\"))
virtualServerPath = virtualServerPath + "\SiteImages\" + dtUser.Rows(0)("Name")
parentDir = Directory.CreateDirectory(virtualServerPath)
childDir = parentDir.CreateSubdirectory(Session("RegID"))
Dim strUserName as String=dtUser.Rows(0)("Name")
If flUpload.HasFile Then
flUpload.SaveAs(Server.MapPath("~/SiteImages/" & dtUser.Rows(0)("Name") & "/" & childDir + "/" + flUpload.FileName))
我越来越关心+的使用和&错误
flUpload.SaveAs(Server.MapPath("~/SiteImages/" & strUserName & "/" & childDir + "/" + flUpload.FileName))
任何人可以帮助清除错误
请参阅下面的答案。这个问题显然无关w /&和+,显然它们是可互换的,尽管我绝不会在VB中使用字符串连字符+。 – 2009-07-15 05:14:41