Stored procedure parameters

Hi

what's the difference between using parameters in these two ways:

SELECT

@PortalName = Portals.PortalName ...

and

SELECT

Portals.PortalName...


first one will NOT be a result set, and second one will

Whats the basic difference between that? I need to use a NextResult method within a .cs file
but it is not working

thanks

0
Carilocus
3/31/2005 9:56:42 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
94 Views

Similar Articles

[PageSpeed] 41

Your first statement is selecting the results of your query into a
variable.  If more than one row is returned that statement will
generate an error.  Typically that variable is set up as an output
parameter.  This approach works well when you need to return
information from one row back to your application.  You would add
a Parameter to your SqlCommand and access the data that way, using a
ExecuteNonQuery

Your second statement would work better if you will need to return multiple rows back to your application.  Typically you would use an ExecuteReader in your application to access the rows selected.



Terri Morton
Engagement Manager, Neudesic

How to ask a question

0
tmorton
3/31/2005 11:27:36 AM
Reply:

Similar Artilces:

VB.NET SQL stored procedure: procedure has no parameters and arguments were supplied
VB.NET SQL stored procedure: procedure has no parameters and arguments were supplied Please assist me:This erorr message is produce when calling the stored procedure in vb.netProcedure AutomateMatterNumber has no parameters and arguments were supplied."MS SQL 2000stored procedure:*/CREATE PROCEDURE dbo.AutomateMatterNumber ASDECLARE @nextMtr AS BIGINTDECLARE @dtToday AS DATETIMEIF NOT EXISTS(SELECT * FROM tempMatter WHERE DATEDIFF(dd,DateSet,GETDATE())=0 )BEGINDELETE FROM tempMatter-- incase there are some old recordsSELECT TOP 1 @nextMtr= CONVERT(BIGINT, MatterNumber) + 1 ,@dtTod...

SQL Stored Procedure to MySQL Stored Procedure Conversion
Hi, I am trying to convert a stored procedure written for sql to one that will work in mysql. I understand that I have to set the variables as IN , but I don't know what to do with the rest of the code. The following is the sql stored procedure that I am trying to convert to msql stored procedure: CREATE PROCEDURE Register_User (@userName Varchar(50), (@PassWord Varchar(50), (@FirstName Varchar(50), (@LastName Varchar(50) ) AS IF EXISTS(SELECT u_ID FROM User_ID Where u_UserName=@UserName) RETURN -1 ELSE INSERT User_ID( u_User...

SQL Stored Procedure Issue
This is the Stored Procedure below ->  SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO /****** Object:  Stored Procedure dbo.BPI_SearchArchivedBatches    Script Date: 5/18/2007 11:28:41 AM ******/if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[BPI_SearchArchivedBatches]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[BPI_SearchArchivedBatches]GO /****** Object:  Stored Procedure dbo.BPI_SearchArchivedBatches    Script Date: 4/3/2007 4:50:23 PM ******/ /****** Object:  Stored Proc...

MS SQL stored procedures inside another stored procedure
Hi,  Do you know how to write stored procedures inside another stored procedure in MS SQL.   Create procedure spMyProc inputData varchar(50) AS  ----- some logical    procedure spMyProc inputInsideData varchar(10) AS    --- some logical   ---  go ------- What exactly are tou trying to do? ***********************Dinakar NethiLife is short. Enjoy it.*********************** Like Function, you can have one function inside another another function. Function1 () {    Function2() } How about store procedure ? spProc1 { &n...

How to convert Sql Server Stored Procedures into Oracle Stored Procedures
Hi All, I am migrating from sql server2000 to oracle. I have moved all table into oracle manually. Now I need to move stored procedure. I don't know how to convert sql server stored procedure into oracle stored procedure form. Is there any tool which will convert directly. Please some one help me. Thank you.    Hi there,Please use the tool bellow, which does the job you want. http://www.swissql.com/products/sqlserver-to-oracle/sql-server-to-oracle.html thanks sharp guy...

sql count using stored procedure withing stored procedure
I have a stored procedure that among other things needs to get a total of hours worked. These hours are totaled by another stored procedure already. I would like to call the totaling stored procedure once for each user which required a loop sort of thing for each user name in a temporary table (already done) total = result from execute totaling stored procedure Can you help with this Thanks It would be easier if you can change the stored procedure into a function. Once you do that, the total can be calculated easily with something like thisSelect Sum(dbo.CalculateHours(User...

Passing Parameters to a SQL Stored Procedure
I need help with a really basic task. I have a formview that works OK for selecting/updating records in the table.  When the user edits the data and clicks submit, the updates post to the table along with two parameter values I add using this in the code-behind: Protected Sub DS_EditMasterOrg_Updating1(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles DS_EditMasterOrg.Updating e.Command.Parameters("@Last_Update_By").Value = User.Identity.Name e.Command.Parameters("@Last_Update_Dt").Value = System.DateTime.Now End Sub The next step,...

Problem with SQL DataSource and Stored Procedure
I'm trying to call a Stored procedure as my SQLDataSource update command but I'm getting the following error: "Procedure or function ProcessTravelPolicy has too many arguments specified." The Update Command looks like this:                     UpdateCommand="ProcessTravelPolicy" UpdateCommandType="StoredProcedure">                     <UpdateParameters>        &n...

Stored Procedure vs. SQL As Datasource
Hi all. Just a quick question about some behaviours I am seeing with a datawindow I've developed. I was handed an existing report for an application and asked to make it more efficient and run faster. The existing report is an external that derives its data from a SQL Server 7 stored procedure and it ran like a pig. The stored procedure creates a temp table, selects data into it, and then supplies that data to the external. Not being a huge fan of stored procedures to begin with, I rewrote the SQL for the report's data just as a SQL Select in a freeform dw and now the ...

Empty parameter in a SQL stored procedure
Hello, How can I establish in a stored procedure that a parameter (date, integer and string) is empty?  Hi, which object or code you are using to run stored procedure from asp.net?Ку! Hi,emont Try This create table Test_Empty_Table (id int identity ,[date] datetime, [Amount] int, [name] varchar(100)) Go insert into Test_Empty_Table select '2008/12/12',123,'Def' union all select '',123,'sdf' union all select '2008/12/12',123,'dfgh' union all select '2008/12/12',123,'dfg' union all select '',0,'...

mapping output parameters of sql stored procedure
hi freinds  I need to call an stored procedure from c# code for ssis package, stored procedure has one output parameter i have creaded one oledb command comonent using C# with this oledb command i want to execute the stored procedure  i have set the oledb command's sql command property like  DestErrorInst.SetComponentProperty("SqlCommand", "exec spInsertErrors ?, ?, ?, ? out"); now i want to map or read this output parameter values how can i achieve this? thanks how can i do this   thanksLad LaxmikantPune Can you use SQLClient instead,...

Calling stored procedure from Pervasive SQL with parameter
I am very new to asp.net. I am trying to call stored procedure from Pervasive Sql and I am getting following error: ERROR [HY000] [Pervasive][ODBC Client Interface][LNA][Pervasive][ODBC Engine Interface]Error in expression: :myticket ERROR [HY104] [Pervasive][ODBC Client Interface]Invalid precision value. Here is my source code: Dim sConnectionString As String = "Provider=MSDASQL;DSN=Craftsman" Dim cn As New Odbc.OdbcConnection(sConnectionString) Dim cmd As New Odbc.OdbcCommand("{call getinfo(:myticket)}", cn) Dim prmticketn...

Passing data to SQL store procedure parameters
This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C33577.B4025D20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi all, In Powerbuilder, I've declared a local store procedure to pass values = into SQL store procedure parameters which then goes off and triggers = some events. I've successfully passed account name to @ps_name (declared = as varchar(40) but fail when passing address varchar(160) to @ps_address = (declared as varchar(160). As powerbuilder does not have varchar nor = text as data...

SQL server stored procedures, tables and parameters
Hi, I was just wondering if something could be explained to me. I have the following: 1. A table which has fields with data types and lengths / sizes 2. A stored procedure for said table which also declares variables with datatype and lengths/ sizes 3. A function in written in VB .net that uses said stored procudure. The code used to add the parameters to the sql command also requires that i give a data type and size. How come i need to specify data type and length in three different places? Am i doin it wrong? Any information is greatly appreciated. Thanks Im us...

SQL Server Stored Procedures/VB.Net
IS there a way inside code for vb.net to programmatically change sorting in a stored procedure???Reason is I need a two way sort and did not want to have to write a SP for each way ....If so Do you have an example..... Most likely the easiest way, is, when you retrieve the data from the sProc, put it in a DataView.. That way, you can sort The DataView by any field, ASC or DESC that you wantDavid WierMCP/ASPInsiderASPNet101.com - where to look first!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on th...

Web resources about - Stored procedure parameters - asp.net.sql-datasource

Parameter - Wikipedia, the free encyclopedia
A parameter (from the Ancient Greek παρά , "para", meaning "beside, subsidiary" and μέτρον , "metron", meaning "measure"), in its common meaning, ...

fb_source Parameter - Facebook-Entwickler
This document lists the complete list of values for the fb_source parameter that is returned with th...

Google / Firefox Parameter - Flickr - Photo Sharing!
HS what? www.seroundtable.com/archives/017105.html

Cat 8: TIA performance standards committee chairman previews parameters of forthcoming twisted-pair cable ...
Category 8, the next-generation twisted-pair cabling specification, is still in development, but the outlook looks quite positive that it will ...

Philippine president asks for 'parameters' of Mayon Volcano tours
Philippine president asks for 'parameters' of Mayon Volcano tours People's Daily Online ... 26, 27, 28, 29, 30, 31. Jan, Feb, Mar, Apr, May, ...

Alternatives to boolean parameters
... ) { PrintLine ( item . Name ); if ( printDetails ) { PrintLine ( item . Description ); } } } Aha! Now can see that the boolean parameter ...

Exporting Error (Error in Parameter...: Apple Support Communities
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability ...

Apple tech monitors device aging, adjusts operating parameters to ensure optimal performance
... describing a method of monitoring the aging of a device's electronics, comparing the data with a global average and modifying operating parameters ...

Is it poor programming practice to pass parameters as objects?
... a free, community-powered network of 100+ Q&A sites . Risser asked: So, we've got a guy who likes to write methods that take Objects as parameters, ...

Parameter Short Film Competition sponsored by Grolsch
Grolsch presents Parameter The A.V. Club Short Film Competition Please Enter Your Date of Birth Ineligible entry Enter For people over the age ...

Resources last updated: 1/1/2016 12:27:56 PM