我對使用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