我寫了下面的代碼:這段代碼爲什麼拋出FormatException?
Dim E_ID As Integer
E_ID = Convert.ToInt16(Request.QueryString("ID"))
但在執行時,我總是得到一個FormatException
:
error: Input string was not in a correct format.
可能是什麼造成的?
我正在發送像這樣的值。
Protected Sub lnkPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkPrint.Click
lnkPrint.Attributes.Add("onclick", "return openBadgeReportPage('" + ddEvent.DataValueField + "','" + ddType.DataValueField + "')")
End Sub
End Class
您在Request.QueryString(「ID」)中獲得什麼值?並請粘貼錯誤文本 – 2011-01-31 11:21:47
ddEvent.DataValueField可能是您的數據庫值字段,您確定您不是指ddEvent.SelectedValue? – 2011-01-31 11:52:32