ExecuteScalar Isn't Returning The Return Value Of A Stored Proceedure?

Jun 4, 2010

I have an sp that deletes a bunch of rows and returns the number of rows deleted...

ALTER PROCEDURE [dbo].[DeleteChangeLog]

@ChangeEntityType bigint,

@StartDate datetime,[code]......

View 12 Replies


ADVERTISEMENT

Asp.net - EF4 Insert In VB And Return ID Of Inserted Row Like ExecuteScalar() Does

Mar 15, 2012

show me how to do an insert with EF4 VB and also how to return the ID of the inserted row?This is what I have got for edit and it works.. I have seen some very confusing ways of doing selects and edits and have found that i'm most comfortable keeping it written nice like this so that I can go back and understand what I have done.

[Code]...

I want to insert a new order with an order_id and value for ExportedToOW and get the order_id back which is auto generated by the DB..

View 1 Replies

Sqlcommand.ExecuteScalar Return Dbnull?

Apr 17, 2009

i tried this sqlcommand select max(food) from foods and i tried this dim x as double=cdbl(cmd.executescalar)and it throws the the exception {System.Invalid CastException}because the food table is empty and the max(food) is null how can i fix that because i want to take the value and add one to it so do i need to catch the error or try another conversion option?

View 2 Replies

ADO.NET: Return Multiple Values Instead Of Only The First In An ExecuteScalar()-like Fashion

Nov 18, 2009

currently, I use this code:

[Code]...

View 10 Replies

Returning Date From Stored Procedure In ASP.Net?

Jun 4, 2010

I want to execute a method on VB.Net to return a date which is in the stored procedure. I tried using ExecuteScalar but it doesnt work it retruns error

'Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query'

below is the code

Public Function GetHolidaydate(ByVal struserID as String) As DateTime
Dim objArgs1 As New clsSQLStoredProcedureParams
objArgs1.Add("@userID", Me.Tag)

[Code]....

View 3 Replies

Returning SmallDateTime From Stored Procedure

Sep 2, 2009

I am posting this here because the sql query seems to be fine, it is the VB code that is the issue. I am new to VB and I have a subroutine that imports a value for the strating and ending time of a report. The error I am getting is: Conversion failed when converting the varchar value 'Aug 20 2009 12:00PM' to data type int. Here is the code for both VB and SQL:

[Code]...

View 3 Replies

Asp.net - ODP.NET Calling A Stored Procedure And Returning A RefCursor

Mar 27, 2011

This problem has driven me mad for over a day now. I can create a connection to the database, I can execute sql and return results from that but I can't seem to call a stored Procedure. Here is the code

[Code]...

it works ok but no results are returned. I've verified that the procedure returns results for the user I'm logged in as. When the query was executing I could see a refcursor in there but it was empty. I must be going mad.

View 1 Replies

Returning A Dataset From An Oracle Stored Procedure?

Mar 2, 2010

I'm trying to get VB6 to access an Oracle (9i) procedure and return a dataset without much success.Not used VB6 that much but I need to do it for this application as we are not able to install the .Net framework on this particular server.Oracle procedure has an input param and an OUT param which is defined as a sys_refcursur

CREATE OR REPLACE PROCEDURE "LOGMNR"."LM" (p_filename in
varchar2, p_recordset OUT SYS_REFCURSOR)[code].....

I get the same error message regardless of wetheror or not the second output parameter is enabled.3709 The connection cannot be used to perform this operation. It is either closed or invalid in this context.how to return a recordset from Oracle to VB6?

View 3 Replies

Returning Multiple Datasets From A Stored Process

Jan 19, 2010

I have an encrypted SQL Server stored proc that I run with (or the vb .net equivalent code of):[code]this returns 2 datasets and the output parameters for the results, the datasets are made up of various table joins etc, one holds the header record and one the detail records.I need to get the 2 datasets into a structure in VB .net (e.g. linq, sqldatareader, typed datasets) so that I can code with them, I don't know what tables any of this comes from and there are alot of them Whooopeee...I came close using Linq to SQL and IMultipleResults but got frustrated when I had to recode it every time I made a change to the designer file.

View 2 Replies

If A Property Has No Explicit Return What Is It Returning?

Feb 27, 2012

I have some code I inherited which has a lot of warnings that I would like to get removed. Many are of the form Property '<propertyname>' doesn't return a value on all code paths. I know why it is saying this, I'm just trying to determine what the correct 0 impact way of fixing this is.[code]Unfortuantely if I put this in my code (having changed the local variable name to avoid collisions) it then complains that it is being used before it has been assigned a value.Try to analyze IL in LinqPad (not sure if this is a good test or not) reveals that the empty method is the same as the above that Reflector gave me but it is different from return Nothing and return "".What can I use to get rid of this warning while guaranteeing the code runs 100% the same? [code]I'm not sure what ldloc.0 does here. I'm wondering if it is trying to get something from a register which will be null and if that is therefore the same as ldnull in this situation but I havent' ever really studied IL much before...

View 2 Replies

Returning Byte Array - Getting The Error On 'Return ImageData'?

May 11, 2011

I have the following function (in a WCF)

[code]...

Problem is, I'm getting the following error on 'Return ImageData':Value of type '1-dimensional array of Byte' cannot be converted to 'Byte'.I've been playing with it, but can't seem to figure out what I need to do to ImageData.

View 1 Replies

Get A Compiler Warning For Functions Returning Value Types, Without Return Statement

Jul 21, 2009

I've just been burned again by the fact that there is no compiler warning when you fail to return a result in a Function that returns a Value type. I wrote the function:

Public Function CompareTo(ByVal other As MessageIndex) As Integer Implements System.IComparable(Of MessageIndex).CompareTo
Me._messageIndex.CompareTo(other._messageIndex)
End Function

which performs the CompareTo Function for two integers, then throws the result away and returns 0, because I forgot to either assign a value to CompareTo, or use Return, and that isn't flagged by the compiler because it's valid VB for a Value type.

I happen never to use "FunctionName = ReturnValue" because it hides information from maintenance programmers and also because I think it's insane .

Is there any way I can get the compiler to issue a warning whenever my Functions are missing a Return, whether it's a Value type or not?

View 11 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

Asp.net - Why Does Ms Sql Stored Proc Only Return An Integer

Nov 4, 2010

I am using vs2008 making an asp.net.vb app. The following stored procedure resolutely insists on returning an integer. I on the other hand was hoping for, and expecting, a single name to be returned. Can anyone help amend the sp or describe what I need to do to get the result I desire.

ALTER PROCEDURE [dbo].[getusername]
(
@email varchar ,
@retvalue nvarchar (10)output

[code]...

View 4 Replies

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

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

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

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

Asp.net - SQL Stored Procedures Failing To Return Values?

Sep 7, 2010

I am working on a Tag system for a news page designed in ASP.NET. For the system I require a TagExists method to check for tags within the database. The stored procedure I have written is below.

ALTER PROCEDURE [dbo].[Tags_TagExists](
@Tag varchar(50))
AS
BEGIN

[code]....

I have tried switching the procedure to return 0 if the tag exists and 1 if it does not and it still returns 0 despite the exact same testing conditions. I have also returned the actual select query and it has complained of the Tag "news" (my test item) not being an int on execution showing the select itself is definitely properly formed.

View 3 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

Web Page To Return Results From Two SQL Stored Procs Via VB?

Apr 17, 2011

I am developing an ASPX web page to return results from two SQL stored procs via VB. When I execute these two stored procs, they both return valid data. But for some reason, when I run this report it doesn't return any errors, however, it doesn't return any records/data either!

Also, I can't debug it for some reason, although I can set breakpoints! This is using VS 2008, but I think reason I can't debug is I believe this is a limited version that just works for SSRS and SSIS.

[Code]...

Could the problem be due to the fact that this web page uses the same SQL connection for both stored procs? The first proc should be returned initially, and the second proc after this screen. So I don't need both stored procs information simultaneously, so I would think I could reuse the same SQL connection.

OK, I found where the problem is located. If I just comment out the Level statement in the Where clause, it does return data. So only thing I changed was that one line in my SQL code and it works. This means missing data must be due to datatype incompatibility, no? What is the problem?

View 2 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







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