I have been cleaning up somebody else's code in Vs2005 .net 2.0
There wer lots of these code pat errors because of unitialized variables in
functions with Conditionals - that may or may not be set . These I have
cleaned up ok.
But I have a few like this one below.
The error is Function BindData doesn't return a value on all code paths
But I only see one code path. What am I missing?
Thanks
Bill
Private Function BindData(ByVal count As Integer, ByVal custID As Integer,
ByVal tempID As Integer, ByVal groupID As Integer)
cmd = New SqlCommand("stp _getPreparedMes sages", con)
da.SelectComman d = cmd
da.SelectComman d.CommandType = CommandType.Sto redProcedure
da.SelectComman d.parameters.ad dwithvalue("@in t_rCount", pSize)
da.SelectComman d.parameters.ad dwithvalue("@in t_UserGroupId", groupID)
da.SelectComman d.parameters.ad dwithvalue("@in t_CustomerID", custID)
da.SelectComman d.parameters.ad dwithvalue("@in t_UserIdAdd",
Session("userID "))
da.SelectComman d.parameters.ad dwithvalue("@si nt_AccessLevel" ,
Session("access Level"))
da.SelectComman d.parameters.ad dwithvalue("@in t_tempid", tempID)
da.SelectComman d.parameters.ad dwithvalue("@in t_pageCount",
SqlDbType.Int). Direction = ParameterDirect ion.Output
da.Fill(ds, "tblPrepMsg s")
pCount = da.SelectComman d.Parameters("@ int_pageCount") .Value
dgPreparedMsgs. DataSource = ds.Tables("tblP repMsgs")
dgPreparedMsgs. DataBind()
End Function
There wer lots of these code pat errors because of unitialized variables in
functions with Conditionals - that may or may not be set . These I have
cleaned up ok.
But I have a few like this one below.
The error is Function BindData doesn't return a value on all code paths
But I only see one code path. What am I missing?
Thanks
Bill
Private Function BindData(ByVal count As Integer, ByVal custID As Integer,
ByVal tempID As Integer, ByVal groupID As Integer)
cmd = New SqlCommand("stp _getPreparedMes sages", con)
da.SelectComman d = cmd
da.SelectComman d.CommandType = CommandType.Sto redProcedure
da.SelectComman d.parameters.ad dwithvalue("@in t_rCount", pSize)
da.SelectComman d.parameters.ad dwithvalue("@in t_UserGroupId", groupID)
da.SelectComman d.parameters.ad dwithvalue("@in t_CustomerID", custID)
da.SelectComman d.parameters.ad dwithvalue("@in t_UserIdAdd",
Session("userID "))
da.SelectComman d.parameters.ad dwithvalue("@si nt_AccessLevel" ,
Session("access Level"))
da.SelectComman d.parameters.ad dwithvalue("@in t_tempid", tempID)
da.SelectComman d.parameters.ad dwithvalue("@in t_pageCount",
SqlDbType.Int). Direction = ParameterDirect ion.Output
da.Fill(ds, "tblPrepMsg s")
pCount = da.SelectComman d.Parameters("@ int_pageCount") .Value
dgPreparedMsgs. DataSource = ds.Tables("tblP repMsgs")
dgPreparedMsgs. DataBind()
End Function
Comment