|
-
Sep 11th, 2008, 03:34 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Bug !
cant seem to spot the bug! Can anyone please?
---------------------------------------------------
Using cmd1 As New SqlCommand(query, MyConn)
cmd1.CommandType = CommandType.StoredProcedure
..................
..................
cmd1.Parameters.Add("@ReturnErrorText", SqlDbType.NVarChar, (100))
cmd1.Parameters("@ReturnErrorText").Direction = ParameterDirection.Output
cmd1.Parameters.Add("@Success", SqlDbType.Int)
cmd1.Parameters("@Success").Direction = ParameterDirection.Output
MyConn.Open()
cmd1.ExecuteNonQuery()
cmd1.Parameters.Clear()
If Not CStr(cmd1.Parameters("@ReturnErrorText").Value) = String.Empty Then 'if there's error messages from stored proc
MessageBox.Show(CStr(cmd1.Parameters("@ReturnErrorText").Value))
MyConn.Close()
Exit Sub
End If
success = CInt(cmd1.Parameters("@Success").Value)
'before clearing the parameters swap the value of @success to see if Commit transaction is executed
cmd1.Parameters.Clear()
If success = 1 Then
MessageBox.Show("New School has been added SUCCESSFULLY.", " Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Using
Last edited by angelica; Sep 11th, 2008 at 10:30 PM.
------------------------------------------------------------------------
If an answer to your question has been helpful, then please, Rate it! 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|