?
Solved

Web Service VB ExecuteNonQuery

Posted on 2012-09-20
4
Medium Priority
?
449 Views
Last Modified: 2012-09-21
In my web service I have a function which executes a stored procedure which needs only one paramater

This is (partial) code
Dim db As Database = DatabaseFactory.CreateDatabase("LocalSqlServer")

 'call stored proc
db.ExecuteNonQuery("usp_NotificationReceiptsEdit", qString)


I need to build another one function that executes a stored procedure which has from 0 to x paramaters

What I'm actually trying to execute is
usp_NotificationReceiptsEdit @encryptedID = 'EBGj5WlSENxIO1LIPIUGPIUGIUGIPI/4de'
0
Comment
Question by:lrbrister
  • 2
  • 2
4 Comments
 
LVL 25

Expert Comment

by:Luis Pérez
ID: 38420869
Please, can you explain your problem better? In SQL Server, a stored procedure cannot have a variable number of parameters. Do you mean that you don't know the exact number of parameters of the stored procedure you need to call?
0
 

Author Comment

by:lrbrister
ID: 38421432
RolandDeschain

Well...I don't need to feed every paramater because I have them set to null...
I'm wondering how to execute that nonquery

-- =======================================================
ALTER PROCEDURE [dbo].[usp_NotificationReceiptsEdit] (
		@NotificationID     INT = NULL
		,@DefinitionID      INT = NULL
		,@RefID                 INT = NULL
		,@hLinkString      VARCHAR(1000) = NULL 
		,@encString          VARCHAR(1000) = NULL 
		,@visitDate            DATETIME = NULL 
		,@createdBy          VARCHAR(50)   = NULL
		,@cancelled            BIT	 = NULL)
AS
BEGIN
	SET NOCOUNT ON;

Open in new window

0
 
LVL 25

Accepted Solution

by:
Luis Pérez earned 2000 total points
ID: 38421444
Well, you can call to ExecuteNonQuery passing a variable number of parameters:
db.ExecuteNonQuery("usp_NotificationReceiptsEdit", qString, anotherParam, anotherOne...)

Hope that helps.
0
 

Author Closing Comment

by:lrbrister
ID: 38421811
That was it...thanks.  Just not familiar with the syntax
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question