|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am trying to execute a stored procedure. The stored procedure has 2 input parameters and 1 output parameter. It also sets a return value. When I try the ExecuteNonQuery method I get an error saying object must implement IConvertible. I define my parameters in the order in which they appear in the stored procedure. I am not sure if I should declare my return value parameter first or last so I tried both to no avail. My execute code is below:
intval = cmd1.ExecuteNonQuery() Any help would be greatly appreciated!! |
|
#2
|
|||
|
|||
|
Return Value
HI
Use this one this will solve your problem. Dim pvoSQL As New SQLADO() Dim pvoCmdBranchList As New SqlCommand(SPName, pvoSQL.pvoConnection) Dim pvoDRBranchList As SqlDataReader Try pvoSQL.goGetConnection(Application("gvsConnectionString")) Dim sqlDR As SqlDataReader Dim rowsModified As Integer Dim param1 As SqlParameter Dim param2 As SqlParameter Dim param3 As SqlParameter Dim param4 As SqlParameter Dim param5 As SqlParameter Dim param6 As SqlParameter 'Dim arrParam() As SqlParameter = New SqlParameter(5) {} param1 = New SqlParameter("@RoleIdList", SqlDbType.VarChar) param1.Direction = ParameterDirection.Input param1.Value = RoleList pvoCmdBranchList.Parameters.Add(param1) param2 = New SqlParameter("@user_code", SqlDbType.VarChar) param2.Direction = ParameterDirection.Input param2.Value = UserCode pvoCmdBranchList.Parameters.Add(param2) param3 = New SqlParameter("@DefRoleCodeID", SqlDbType.Char) param3.Direction = ParameterDirection.Input param3.Value = DefaultBranch pvoCmdBranchList.Parameters.Add(param3) param4 = New SqlParameter("@CreatedBy", SqlDbType.VarChar) param4.Direction = ParameterDirection.Input param4.Value = CreatedBy pvoCmdBranchList.Parameters.Add(param4) param5 = New SqlParameter("@ModifiedBy", SqlDbType.VarChar) param5.Direction = ParameterDirection.Input param5.Value = ModifiedBy pvoCmdBranchList.Parameters.Add(param5) param6 = New SqlParameter("@RETURN_VALUE", SqlDbType.Int) param6.Direction = ParameterDirection.ReturnValue pvoCmdBranchList.Parameters.Add(param6) 'pvoCmdBranchList.Parameters.Add(arrParam) With pvoCmdBranchList .Connection = pvoSQL.pvoConnection .CommandType = CommandType.StoredProcedure .ExecuteNonQuery() End With Dim retValue As Integer = param6.Value If retValue = 1 Then Return True Else Return False End If Catch err As Exception Response.Write(err.Message) Finally If Not pvoDRBranchList Is Nothing Then pvoDRBranchList.Close() End If pvoCmdBranchList.Dispose() pvoCmdBranchList = Nothing pvoSQL.goCloseConnection() End Try Sudhir Sharma |
|
#3
|
|||
|
|||
|
Thank You
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Need Help with ExecuteNonQuery |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|