2016-12-29 62 views
-1

下面這行代碼在aspx代碼在本地機器上的IIS下運行時出現上述錯誤。BC30201:預期表達式

Details = If(.GetString(2) = "", "", "<div><b>" & .GetString(2) & "</b></div>") 

完全相同的代碼運行,而無需在生產Web服務器上的錯誤。 我剛剛接管了這個網站,我還沒有遇到過這種類型的If語句。

下面是preceeds以上其產生BC30201錯誤的語句的代碼。

' Execute SQL procedure to fetch performance details 

With New SQLCommand("FetchPerformance1", New SQLConnection(ConfigurationManager.ConnectionStrings("C1").ConnectionString)) 

.Parameters.AddWithValue("@Performance", Code) 
.Parameters.AddWithValue("@Filters",  Convert.ToByte(Mid(Query, 24, 1), 16)) 

.CommandType = StoredProcedure : .Connection.Open 

With .ExecuteReader(CloseConnection) 


' If performance not found ... 

If Not .Read 


' Display message page: 




' Terminate script: 

    .Close : Response.End 

End If 


' Construct performance details string: 

If .GetInt32(0) > 0 Then Links = "<a href=""view3.aspx" & Left(Query, 24) & Hex(.GetInt32(0)) & """ style=""float: left"">&lt;&lt;</a>" 
If .GetInt32(1) > 0 Then Links &= "<a href=""view3.aspx" & Left(Query, 24) & Hex(.GetInt32(1)) & """ style=""float: right"">&gt;&gt;</a>" 
+0

你得到哪個錯誤? 語法看起來很奇怪。點運算符('.')表示您正在訪問對象的方法,但點之前沒有任何東西。此外,如果意味着應該在'true'和'false'之間做出決定,並且這裏沒有這樣的事情。 –

+0

BC30201:期望的表達式是我得到的錯誤。點運算符(。)引用記錄的第三個字段。我的第二個問題是我沒有完全理解if語句試圖達到什麼目的。 – DZS50

+0

我認爲我們需要的不僅僅是一條線。給我們一些代碼。我們還在看哪種語言? –

回答

0

配置IIS使用ASP.NET版本:4.0.30319.36373。它工作正常

+0

而原因是'If'運營商不支持的在.Net版本2.0中的VB –