我想拋出一個異常,在我的BLL時,有沒有相應的carID因爲我已經在文本框中輸入的車牌號沒有發現任何數據。如何扔在BLL一個異常時,在DAL
我DAL看起來是這樣的:
Public Class DALCar
Private dc As New cars_modelDataContext
Public Function getCarIdByLicenePlate(ByVal licensePlate_input As String) As String
Dim result = (From car In dc.Cars
Where car.License_Plate = licensePlate_input
Select car.License_Plate).Single
Return result
End Function
End Class
這是我BLL:
Public Class BLLCar
Private DALcar As New DALCar
Public Function getCarIdByLicenePlate(ByVal licensePlate_input As String) As String
Dim carID As String = DALcar.getCarIdByLicensePlate(chassisNo_input)
End Function
End Class
所以當有這個特殊車牌的異常在我的DAL扔沒有carID,但我怎樣才能在我的BLL而不是在我的DAL中拋出這個異常?
謝謝,我會嘗試了這一點! – Wout