Sql Server - Return Value From Stored Procedure?

Oct 11, 2010

I am using vs 2008 doing a winforms app in vb.net. I have a database with a single table, that has two columns, in it and a stored procedure. The stored procedure is supposed to take an input value, match that value against one column in the table and then return the corresponding value from the other column; except it doesnt.It returns 1 or 0

ALTER PROCEDURE dbo.getgamenumber(@outputnumber bigint OUTPUT,
@inputnumber bigint)
AS

SELECT @outputnumber = ggnumber[code]......

but I still dont get the value I expect.

View 4 Replies


ADVERTISEMENT

ASP.NET A SQL Server Stored Procedure With Return

Jan 8, 2012

So I want to erase the guid @value from the database and retrieve the return value from my stored procedure [code]object name 'value' not valid..Net SqlClient Data Provider0.

View 4 Replies

Call A Stored Procedure From Sql Server Which Work With A Stored Procedure

Sep 11, 2009

The store procedure which give me the information I need is:

USE [UCSMIS]
GO
SET ANSI_NULLS ON

[Code].....

When I try to add it to my report it gives an error, is it because of the temp table and how should I go about it?

View 2 Replies

CanNOT Get The Return Value From Own Stored Procedure?

Jan 22, 2011

Why I can NOT get the return value (Scope_Identity) by executing my own Stored procedure (SQL Server 2008) via this below code written in VB.NET 2008? The SP inserts the new record into Table1 but I have 0 as the return value!What's wrong with it?here is my vb.net code and my SP:

Public Function Insert(ByVal Obj As entity, connectionString As String) As Integer
Dim ScopeIdentity As Integer
Dim Connection As New SqlConnection(connectionString)

[code]....

View 2 Replies

Get A Return Value From A Stored Procedure?

Sep 6, 2010

I have a stored procedure in SQL Server for generating transaction numbers.how to call the Stored Procedure from VB.NET and how will i get the value that is returned from the procedure into the front end.

View 3 Replies

Get Return Value Stored Procedure?

May 27, 2007

I use an adapter to execute the SP

Dim x As New TDataSetTableAdapters.QueriesTableAdapter
x.SP_BulkPayOut(BeginDate, EndDate)
The SP has a return value
How do I capture this

What do I have to change about my approach

View 6 Replies

Return Value From Stored Procedure?

Aug 23, 2009

I am having problems getting the return value from a stored procedure.As I said the last time, while I am an old programmer, I am new to visual languages.The code is as follows:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strServerName As String
Dim intServerID As Integer[code]....

From what I have read this should work. I think I have declared the parameters correctly.When I run the stored procedure from SQL it returns the correct value so I know the problem is in VB.It is a simple stored procedure, however, I am trying to remain consistent and use stored procedures as much as possible.

View 6 Replies

C# - Stored Procedure Return Varchar Value

Jul 1, 2010

I am trying to create stored procedure that gone return varchar value, and that value I need to display in textbox. This is the code for stored procedure:

[Code]...

View 3 Replies

Return Values Of Stored Procedure?

Jun 11, 2011

the stored procedure is within a transaction. I want to get the inserted values after calling the stored procedure. My problem is, I don't know if that is possible because the transaction is not yet commited.

View 1 Replies

Ms Sql Stored Procedure Return Data Without Output?

Mar 16, 2012

i am trying to find examples of getting data back from a stored procedure that has no parameters sent to it nor has any returned output parameter. Though it does display data.How can i get that from my code im using below?

Dim myCommandSQL As New SqlCommand
Dim myReaderSQL As SqlDataReader = Nothing
Dim intX As Integer = 0[code]....

The @return_value i just put there to see what would happen but i got nothing returned.

View 2 Replies

Asp.net - Execute Stored Procedure Using Sqldatasource And Get Return Value?

Sep 15, 2010

How can I execute a stored procedure using sqldatasource and get the return value in vb.net.

View 2 Replies

Asp.net - Return Two Tables From A Stored Procedure From LINQ To SQL?

Aug 4, 2011

I have written a stored procedure like this:

CREATE PROCEDURE [dbo].[TestProcedure]
AS
BEGIN
SELECT TOP 1 CampaignID FROM Campaigns
SELECT TOP 1 ServiceID FROM Services ORDER BY ServiceID desc
END

In my .NET Project, I have a LINQ to SQL file (.dbml) and I have drag-and-dropped this procedure to create a new class TestProcedureResult:

Partial Public Class TestProcedureResult
Private _CampaignID As Integer
Public Sub New()

[Code]....

So it is not returning ServiceID. How can I retreive ServiceID using LINQ to SQL? I know we can customize stored procedure calls, but how can I customize in this particular scenario?

View 1 Replies

SQL Stored Procedure Return Multiple Tables?

Jun 9, 2010

Like the title says I want to create a SQL (2005) stored procedure where I say:

Select a, b, c from A
Select b, c, d from B
Select c, d, e from C

[code].....

View 2 Replies

Tell If A Stored Procedure Does Not Return Results When Using Linqtosql?

Aug 19, 2010

I have a linqtosql dbml where I dropped a stored procedure into the designer interface.

Stored procedure name:
GetUser(@userid int)
Select * from users_tbl where userid=@userid

[code].....

View 1 Replies

How To Call Stored Procedure And Retrieve Single Return Value

Jul 22, 2010

I'm new to LINQ and am having a problem getting proper results from a simple (working) stored procedure that takes no parameters and returns a single Integer. When calling this sproc with LINQ its returnvalue is always 0. When run using tableadapter or directly on the sql server it works, returning 6 digit values like 120123.

Here is my LINQ code:

Dim MeetingManager As New MeetingManagerDataContext
Dim MeetingID As Integer = MeetingManager.NewMeetingID().ReturnValue Here is the NewMeetingID procedure:
ALTER PROCEDURE [dbo].[NewMeetingID]
AS
SET NOCOUNT ON
BEGIN

[Code]...

View 1 Replies

LINQ Stored Procedure Return Value To A String Array?

Mar 24, 2011

I have a stored procedure in DBML and I try to pass the result to "sqlQryArray" as an array(1 dimensional array). But the bottom code causes error like below message. What else should be done?

Error 1 Value of type '1-dimensional array of aaaDatabase.stp_GetSomethingResult' cannot be converted to '1-dimensional array of String' because 'aaaDatabase.stp_GetSomethingResult' is not derived from 'String'.

The return result from stored procedure is a just list of first names of students(only one column)

Dim sqlQry = aaaLINQ.stp_GetSomething(bbb,ccc,ddd)
Dim sqlQryArray As String() = sqlQry.ToArray()

View 2 Replies

Method To Execute Stored Procedure And Return Datatable In C#?

Jan 21, 2012

I have some VB code like

Dim data As DataTable = DataAccess.ExecuteDataSet("AuthenticateWebServiceClient" _
, New SqlParameter("@ClientID", ClientId) _
, New SqlParameter("@Password", Password) _[code]....

Except PrepareSPCommand isn't recognized by VS. Does anyone know the correct way to convert this function to C#.

View 2 Replies

Return The SCOPE Identity Of The Inserted Record In Stored Procedure @temp_id?

Jul 10, 2010

I'm trying to return the SCOPE Identity of the inserted record in my stored procedure @temp_id, but how can I bind it to a label e.g

<asp:ControlParameter ControlID="ASPxLabel_RequestTemp" Name="temp" PropertyName="Text" Type="Int32" />

View 1 Replies

SQL Server Stored Procedure?

Apr 4, 2012

I am using the following stored procedure to call period numbers to match them to teachers.We are writing an attendance taking application where upon selecting the teacher's name from a dropdown menu, the "period" dropdown menu populates. For some reason we are not getting the period data to populate.

Stored Procedure:
ALTER PROCEDURE spGetPeriod @Period varchar(10)
AS
SELECT Period
FROM tmTeacher

[Code]...

View 3 Replies

Calling SQL Server Stored Procedure?

Jun 22, 2011

STORED PROCEDURE

ALTER Procedure [dbo].[usp_validatecard](
@CLUBCARD1 nvarchar(50),
@STATUS nvarchar(50))[code]....

What I am trying to do is if the clubcard parameter is found and status is active I would like the label to read 'card is good' also if the clubcard parameter is found however is inactive then the label should read 'card is good but not active' last if all those fail just have the label read 'card not in system'As of right now this code does not work I thought I could just call the stored procedure and exec it and it would print the statements depending on what passes however it is erroring out. When I debug it the error I get is under the cmd.parameters.add is

Item In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

View 3 Replies

Executing Sql Server Stored Procedure In VB?

Mar 7, 2011

I want to execute a sql server stored procedure in vb using a button. The stored procedure as one variable that is read from a text file.I got it to read the variable from the text file but don't know how to execute the stored procedure.

View 1 Replies

Get Value From SQL Server 2005 Stored Procedure

Jun 20, 2010

This is my Stored Procedure Code to get the customer mobile value:[code]I was try to get this value into lblGetCustMobile (Label Control) using this [code]but nothing happened, can any one make this code get the mobile NO. into lblGetCustMobile?

View 3 Replies

SQL Server Stored Procedure And Execute

Apr 29, 2012

This is a bit old-contents to be discussed but I need someone who can explain me how to create stored procedure in SQL Server for returning a value from procedure, example:[code]Then I need the name of its customer and the address instead.I need to make it as a stored procedure and show me how to execute it on VB.NET. Perhaps we assume that the name will be prompted to LABEL1.TEXT and the address will be prompted to LABEL2.TEXT. I've improved this SQL-Server Stored Procedure Using return but I have nothing to return after I execute it.[code]

View 1 Replies

ASP.NET: Retrieve Information From SQL Server Via Stored Procedure?

Jun 3, 2012

Created an XSD file that represents my table structure from my database. Created a class file to hold my functions such as the one below.

Code sample:

Public Function GetUser(ByVal UserID As String) As xsdUser.UserDataTable
Dim SqlConn As New SqlConnection(ConfigurationManager.ConnectionStrings("MyDatabase").ConnectionString)

[Code]....

Now it seems odd to me to have two files doing what should be contained within just one file. I feel like I should have one class file called "User" and have member variables in there along with the class functions like the one above. But all the tutorials I see are using these data tables. On top of that I'm not sure how to handle the if statement at the end of the function. I don't think I would want to return a whole DataTable since I should only have one row, and I also don't know how I would handle an error if my function is supposed to return a data table. I suppose I could return an empty one and then if the table is empty in my code then I would handle it there, but this also seems messy.

Is this the common way of retrieving information from a stored procedure? Or is there a more up-to-date method that I'm not seeing in my search results?

View 2 Replies

Combo Box, Datagrid And SQL Server Stored Procedure?

May 17, 2012

I have a problem trying to link my my datagrid view to my sql server stored procedure. The way it should work is that when I select an item in a list from my combo box it returns a set of rows on the datagrid view specific only to that item This is the code on the server sideCREATE PROCEDURE spCompanySearch

[Code]...

The @comp is supposed to be each item in the combobox list but I don't know how to do it or how to go about it

View 6 Replies

SQL Server 2008 Stored Procedure With DateTime2

Aug 19, 2011

I have a small question about stored procedures and the DateTime2 datatype in SQL Server 2008.

I got several stored procedures using the DateTime2 datatype and I want to insert the date 0001.01.01 00:00:00 but this won't work with VB.net and I cannot find the reason why.

I use this code fragment:

Dim sqlStatement As New SqlClient.SqlCommand
Dim sqlTransaction As SqlClient.SqlTransaction
sqlStatement.CommandType = CommandType.StoredProcedure

[Code]....

to call the stored procedures from my program (the stored procedure is a simple INSERT statement nothing else and works fine with actual dates). But when I enter the date 0001.01.01 00:00:00 it always comes up with the error that I cannot insert dates before '01.01.1753' when I want to execute the stored procedure.

Now I already know that the DateTime2 datatype in SQL Server should support this.

So my question is it possible that this is a driver problem and updating the SQLClient would solve this, or is this a general problem and I can finally stop searching and just use 1753.01.01.

View 1 Replies

Error While Inserting Record Using SQL Server Stored Procedure

Jul 4, 2009

I am using sql server 2008 as database server. I have created "AddTest" stored Procedure and using it in my app,

Dim cn As new SqlConnection(connStr)
Dim da As New SqlDataAdapter("Select * from dbo.Subjects", cn)
Dim ds As DataSet

[code]....

View 3 Replies

Importing Data From Excel To SQL Server Via Stored Procedure

Apr 21, 2011

I found a few examples online on how to import excel into sql via vb. but can i do it via stored procedure?
Insert into SQLServerTable Select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D: esting.xls;HDR=YES',
'SELECT * FROM [SheetName$]')

So like, can I pass in:
('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D: esting.xls;HDR=YES',
'SELECT * FROM [SheetName$]')
As a parameter to SQL Server SP?

View 1 Replies

Pass Datatable As A Parameter To A SQL Server Stored Procedure

Jul 29, 2011

how to Pass datatable as a parameter to a SQL Server stored procedure

View 3 Replies

Pass Values From A Form To Sql Server Stored Procedure?

Jan 12, 2011

I have an application that I'm building which pulls dates from a database. The start value is stored as payPeriodStart date and I add 7 days to get the end date. What I need to know is, is it possible to store those values and pass them to a Stored Procedure? Currently my stored procedures have "static" dates in them ie[code]...

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved