Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Store Proc

Author  Topic 

kwikwisi
Constraint Violating Yak Guru

283 Posts

Posted - 2009-10-27 : 03:05:07
Below code always retrue false even there is no row that match with condition...Can pls anyone check for me ?

cmd = New SqlCommand("test_proc", con)
cmd.CommandType = CommandType.StoredProcedure

pid = New SqlParameter("@pid", SqlDbType.Int)
pid.Value = uid
pid.Direction = ParameterDirection.Input
cmd.Parameters.Add(pid)

pcount = New SqlParameter("@pcount", SqlDbType.Int)
pcount.Direction = ParameterDirection.Output
cmd.Parameters.Add(pcount)

con.Open()
cmd.ExecuteNonQuery()

If Not IsDBNull(pcount.Value) Then
count = CInt(pcount.Value)
If count > 0 Then
Return False
ElseIf count = 0 Then
Return True

End If
Else
Return True
End If

sanoj_av
Posting Yak Master

118 Posts

Posted - 2009-10-27 : 05:00:05
Can you post the content of test_proc ?
Go to Top of Page
   

- Advertisement -