I’ve got a sql stored proc that is working fine in SSMS. When I try and execute through code and assign the return to a dataset I am getting zero rows back. I’ve used the immediate window to ensure that I am sending the correct params to the stored proc and that is all good.
What else would cause me to get zero rows assigned to the dataset. Here is my code.
Thanks,
Mike
EDIT: I’m not getting any exceptions from SQL..
Public Function GetTransReporting(ByVal transNumber As Long, ByVal customerID As Long) As DataCommon.transReporting
Dim myTransReporting As New transReporting
Dim da As SqlDataAdapter
Dim prm1 As SqlParameter
Dim prm2 As SqlParameter
mcmd = New SqlCommand
mcmd.CommandType = CommandType.StoredProcedure
mcmd.Connection = mcn
mcmd.CommandText = "GetTransReportingByCustomerID"
prm1 = New SqlParameter("@transNumber", Data.SqlDbType.BigInt)
prm1.Value = customerID
mcmd.Parameters.Add(prm1)
prm2 = New SqlParameter("@customerNumber", Data.SqlDbType.BigInt)
prm2.Value = transNumber
mcmd.Parameters.Add(prm2)
da = New SqlDataAdapter(mcmd)
da.Fill(myTransReporting)
Return myTransReporting
End Function
Got it.. if you take a look at my parameters up top I am accidentally assigning transaction to customer and customer to transaction. DOH!
Thanks,
Mike