.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 3rd, 2004, 11:38 AM
jcollins jcollins is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 2 jcollins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Need Help with ExecuteNonQuery

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!!

Reply With Quote
  #2  
Old May 5th, 2004, 04:09 AM
sudhirsharma23 sudhirsharma23 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 3 sudhirsharma23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old May 9th, 2004, 11:55 AM
jcollins jcollins is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 2 jcollins User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile Thanks

Thank You

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Need Help with ExecuteNonQuery


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT