|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: |
Updated Event: called from OnUpdated in the ObjectDataSource:
Protected Sub ods1_Updated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles ods1.Updated
Dim intRetVal As Integer = -1
Dim OutputParametersCount As Integer = -1
OutputParametersCount = e.OutputParameters.Count
lblUpdateResult.Text = CStr(OutputParametersCount)
intRetVal = e.OutputParameters("ReportForThisOfficer").Value
If intRetVal = 5 Then
lblUpdateResult.Text = "Message #1 &"
ElseIf intRetVal = 7 Then
lblUpdateResult.Text = " Message #2 &."
ElseIf intRetVal = 6 Then
e.ExceptionHandled = True
lblUpdateResult.Text = " Message #2 &."
Else
lblUpdateResult.Text = "The expected values not returned by SP"
End If
End Sub
ObjectDataSource:
<asp:ObjectDataSource
ID="ods1"
onobjectcreating="OfficerIDObjectCreating"
SelectMethod="GetOfficersForApproval"
UpdateMethod="UpdateOfficersForApproval"
OnUpdated="ods1_Updated"
typename="TSSSp1A.clsTSSLevels1A"
runat="server">
<UpdateParameters>
<asp:QueryStringParameter
Name="OfficerID"
Type="Int32"/>
<asp:Parameter
Name="CertificationNo"
Type="Int32"/>
<asp:Parameter
Name="UserType"
Type="Int16"/>
<asp:Parameter
Name="Username"
Type="String"/>
<asp:Parameter
Name="MyPassword"
Type="String"/>
<asp:Parameter
Name="ReportForThisOfficer"
Direction="Output"
Type="Int32" />
</UpdateParameters>
</asp:ObjectDataSource>
Class Code: ( see ObjectDataSource (above) typename="TSSSp1A.clsTSSLevels1A")
Public Function UpdateOfficersForApproval(ByVal OfficerID As Int32, ByVal CertificationNo As Int32, ByVal UserType As Int16, ByVal UserName As String, ByVal MyPassword As String, ByVal ReportForThisOfficer As Int32)
Dim con As New SqlConnection(_conString)
Dim cmd As New SqlCommand("UpdateOfficersForApproval", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@OfficerID", OfficerID)
cmd.Parameters.AddWithValue("@CertificationNo", CertificationNo)
cmd.Parameters.AddWithValue("@UserType", UserType)
cmd.Parameters.AddWithValue("@Username", UserName)
cmd.Parameters.AddWithValue("@MyPassword", MyPassword)
cmd.Parameters.Add("@ReportForThisOfficer", Data.SqlDbType.Int)
cmd.Parameters("@ReportForThisOfficer").Direction = Data.ParameterDirection.Output
con.Open()
Return cmd.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Stored Procedure:
ALTER PROCEDURE [dbo].[UpdateOfficersForApproval]
-- Add the parameters for the stored procedure here
@OfficerID int,
@CertificationNo int,
@UserType int,
@Username varchar(75),
@MyPassword varchar(50),
@ReportForThisOfficer int OUTPUT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
IF EXISTS
(
SELECT * FROM Officer
WHERE CertNo = @CertificationNo
AND UserType = 1 -- Another officer w/ same CertNo has been approved by the TSS Admin.
)
BEGIN
SET @ReportForThisOfficer = 5 -- means we have a duplicate Certification No and cannot do the update
RETURN
END
ELSE
BEGIN
Update Officer
SET UserType=@UserType, Username=@Username, MyPassword=@MyPassword
Where OfficerID=@OfficerID
IF(@@ERROR <>0) GOTO ERR_HANDLER
SET @ReportForThisOfficer = 7 -- succesful update
RETURN
END
END
ERR_HANDLER:
PRINT 'An Error occurred in the Update'
SET @ReportForThisOfficer = 6 -- MEANS ERROR OCCURED IN THE update
RETURN
|
Advertisement
| Hall of Fame |