I have the following code in my application. When it is executed it brings out a null value at times, where i am sure there should be a value returned. I have checked by running the sql statement in the database and it returns the correct value. What could be wrong with my code? Thanks.
Private Sub GetQtyAlreadyMade() Dim ds As New DataSet Dim strSQL As String = "Select Sum(QuantityProduced) as QtyProduced from dbo.Historian where JobNo = '" & Trim(strDtgJobNo) & "' AND StockCode = '" & Trim(strDtgStockCode) & "'" ds = querySQL(strSQL) If Not ds.Tables(0).Rows(0).Item("QtyProduced") Is DBNull.Value Then int_Total_Made = ds.Tables(0).Rows(0).Item("QtyProduced") Else int_Total_Made = 0 End If End Sub
This post has been edited by PsychoCoder: 01 March 2010 - 03:10 PM
Reason for edit:: Fixed code tags