hi there i just started .NET (ASP n
VB) this semester n i created this webpage which brings back data from the database ... whn i enter the search parameter it gives me this error .. "Cast from string "" to type 'Integer' is not valid."
heres my code ...plz help me out ...
LookUpInventoryByStockNumber.aspx.vb
Private Sub btnSearchInvt_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchInvt.Click
Try
Dim InventoryInformation As DataSet = Lab1.OrderSystem.LookUpInventoryByStockNumber(txtE mpID2.Text, StockNum.Text)
If InventoryInformation.Tables("InventoryInformation" ).Rows.Count > 0 Then
With InventoryInformation.Tables("InventoryInformation" ).Rows(0)
StockNum.Text = .Item("StockNumber")
InventoryNumber.Text = .Item("InventoryNumber")
Description.Text = .Item("Description")
Price.Text = .Item("Price")
ReOrderLevel.Text = .Item("ReOrderLevel")
UnitCost.Text = .Item("UnitCost")
OrderUnitSize.Text = .Item("OrderUnitSize")
OrderUnitType.Text = .Item("OrderUnitType")
Discontinued.Text = .Item("Discontinued")
QuantityOnHand.Text = .Item("QuantityOnHand")
End With
Else
lblErrStock.Text = txtEmpID2.Text & " was not found "
End If
Catch ex As Exception
lblErrStock.Text = ex.Message
End Try
End Sub
Inventory.vb
Public Class Inventory
Public Shared Function LookInventoryByStockNumber(ByVal EmployeeID As Integer, ByVal StockNum As Integer) As DataSet
Dim eVideo As SqlConnection = New SqlConnection(eVideoConnectionString)
Dim adapter As SqlDataAdapter = New SqlDataAdapter("exec LookUpInventoryByStockNumber @EmployeeID, @StockNum", eVideo)
adapter.SelectCommand.Parameters.Add("@EmployeeID" , SqlDbType.Int).Value = EmployeeID
Dim InventoryInformation As DataSet = New DataSet
adapter.Fill(InventoryInformation, "InventoryInformation")
Return InventoryInformation
End Function
End Class