• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • Last Modified:

Web Service VB ExecuteNonQuery

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
Larry Brister
Asked:
Larry Brister
  • 2
  • 2
1 Solution
 
Luis PérezSoftware Architect in .NetCommented:
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
 
Larry Bristersr. DeveloperAuthor Commented:
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
 
Luis PérezSoftware Architect in .NetCommented:
Well, you can call to ExecuteNonQuery passing a variable number of parameters:
db.ExecuteNonQuery("usp_NotificationReceiptsEdit", qString, anotherParam, anotherOne...)

Hope that helps.
0
 
Larry Bristersr. DeveloperAuthor Commented:
That was it...thanks.  Just not familiar with the syntax
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now