Results 1 to 5 of 5

Thread: [RESOLVED] Bug !

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Resolved [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
  •  



Click Here to Expand Forum to Full Width