我還在尋找答案,而我還在努力這個Visual Studio的 開發使用VB.net語言的一些web應用程序...VB.net打印出try和catch
嗯....我其實是想印出我抓的消息, 但不知何故,如果我把這個...
Try
Dim oCommand As MySqlCommand = New MySqlCommand("SELECT * FROM suppliermst WHERE supplierid = " & p_iSupplierId, oConnection)
oConnection.Open()
oReader = oCommand.ExecuteReader
While oReader.Read
oSuppliermst = New suppliermst
oSuppliermst.supplierId = oReader("supplierid")
oSuppliermst.name = oReader("name")
oSuppliermst.state = oReader("state")
oSuppliermst.telNo = oReader("telno")
oSuppliermst.mobileNo = oReader("mobileno")
oSuppliermst.faxNo = oReader("faxno")
oSuppliermst.email = oReader("email")
oSuppliermst.countryCode = oReader("countrycode")
oSuppliermst.companyName = oReader("companyname")
oSuppliermst.city = oReader("city")
oSuppliermst.address1 = oReader("address1")
oSuppliermst.address2 = oReader("address2")
oSuppliermst.postCode = oReader("postcode")
End While
Catch ex As Exception
'log here
Console.WriteLine("error on getSuppliermstBySupplierId() function" & ex.Message)
Finally
closeMySqlDataReader(oReader)
closeMySqlConnection(oConnection)
End Try
漁獲不給我任何東西...... 如何打印輸出在VB中醒目。淨?
嘗試'ex.Message.ToString()'而不是 – 2011-04-20 09:10:21
它是一個Web應用程序嗎? – 2011-04-20 09:11:54
@kalyan [Exception.Message](http://msdn.microsoft.com/en-us/library/system.exception.message.aspx)已經是一個字符串了。 ToString從對象繼承。 – Smudge202 2011-04-20 09:23:41