label cant display total value... pls help
Hi,
im trying to display my sum value with a label, but it show me this error. i've no idea bout this...
Exception Details: System.IndexOutOfRangeException: AvaiStockQty
Source Error:
Line 46: ObjReader=ObjCmd1.ExecuteReader
Line 47: While ObjReader.Read()
Line 48: lbl.text=ObjReader.Item("AvaiStockQty")
Here is my code:
StrSQL="Select Sum(AvaiStockQty) FROM StockOnHand Where ItemCode=@b"
Dim ObjCmd1 as OledbCommand= New OleDbCommand(StrSQL, Conn)
Dim Stock as String
ObjParam= Objcmd1.Parameters.Add("@b", OleDbType.VarChar)
ObjParam.Direction= ParameterDirection.Input
ObjParam.Value=tb1.Text
ObjCmd1.Connection.Open()
ObjReader=ObjCmd1.ExecuteReader
While ObjReader.Read()
lbl.text=ObjReader.Item("AvaiStockQty")
End While
I'd tried lbl.text=ObjReader.Item(Sum("AvaiStockQty")) etc... but none seems to work. Can any1 pls help on this?
Thanks in advance
Life's Ng
|