DataSource Controls :: Returning Single String Value Using Linq And Stored Procedure

Jun 21, 2010

I can return single integer values when using stored procedures with Linq but I cant get single string values returned.

View 2 Replies

Similar Messages:

DataSource Controls :: Returning String Value Using Stored Procedure And Linq

Feb 7, 2010

I am having problems returning a string value through a stored procedure/linq to a label. Everything works fine if I return an integer value but I cant get a string value to bind to a label. I get the error message

Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value,
NumberFormatInfo NumberFormat) +201
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +66
[InvalidCastException: String "System.Data.Linq.SqlClient.SqlPr" to 'Integer' is invalid‚]

This is the stored procedure
Select ProductName
From Products

This is the vb page
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim db As New DataClassesDataContext
Dim product As Integer = db.test.ToString
Label1.Text = product
End Sub

This is the aspx page
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>

View 1 Replies

Forms Data Controls :: Returning Single String Result Through Stored Procedure

Jun 22, 2010

I am trying to return single string result through a stored procedure and Linq. This works fine when I test the stored procedure but it is not returning the value to the page. The value returned is always 0 which is the return value. This is the stored procedure:

@CustomerName nvarchar(50),
@Password nvarchar(50) output
Select @Password=Password
From Customers
Where Customers.CustomerName=@CustomerName

This is the vb
@CustomerName nvarchar(50),
@Password nvarchar(50) output
Select @Password=Password
From Customers
Where Customers.CustomerName=@CustomerName is the code created by the designer

This is the designer function
<FunctionAttribute(Name:="dbo.Login")> _
Public Function Login(<Parameter(Name:="CustomerName", DbType:="NVarChar(50)")> ByVal customerName

As String, <Parameter(Name:="Password", DbType:="NVarChar(50)")> ByRef password As String) As IntegerDim result
As IExecuteResult = Me.ExecuteMethodCall(Me, CType(MethodInfo.GetCurrentMethod,MethodInfo), customerName, password)
password = CType(result.GetParameterValue(1),String)
End Function

View 4 Replies

DataSource Controls :: Stored Procedure Not Returning Value

May 15, 2010

I call this stored procedure with a dataset. It always returns a 0 but should return a 1 or 2. Does anybody know why it isn't returning a 1 or 2.

ALTER PROCEDURE dbo.sp_InsertLinkVote
@LinkId int,
@LinkVoter nvarchar(50),
@LinkVotesDateTime datetime,
@LinkVotesGoodBad bit
LinkVoter = @LinkVoter )RETURN
dbo.LinkVotes (LinkId,LinkVoter,LinkVotesDateTime,LinkVotesGoodBad)VALUES

Here is were a call it in my code behind.
Dim VoteCheck
Dim InsertVote
New DataSetStoredProceduresTableAdapters.QueriesTableAdapter
VoteCheck = InsertVote.sp_InsertLinkVote(LinkId, User.Identity.Name, DateAndTime. Now,
'0 is a good vote.
If VoteCheck = 0

It seems to insert and not insert correctly, I just cannot get it to return the correct value.

View 4 Replies

DataSource Controls :: Returning Value From Stored Procedure

Jun 23, 2010

I am developing a page in ASP.Net where I have the user enter a letter into a textbox. They then click a submit button and I all of the userids that start with that letter are to be displayed. So I need the SP to go through the database and match first letters with what was entered. Here is what I have as my code for the SP:

CREATE PROCEDURE dbo.exp2 @testchar Char(1)
declare @flag as char(2)
set @flag = @testchar + '%'
select userid
from ex_database
where userid like @flag

View 6 Replies

DataSource Controls :: Stored Procedure Returning Error?

May 24, 2010

Im trying use a storedprocedure where depending on the status of the room if ='Vacant' And checkIn =date and the result will be put in a gridview, but i kept returning an error that says, "Conversion failed when convertng datetime from character string". Heres the code.



Stored Procedure:




View 7 Replies

DataSource Controls :: Stored Procedure And Function Returning Same Shape

Jan 26, 2010

I have problem with a stored procedure and function that return the same shape, but as they are different methods LINQ won' t let me cast between the two. Please see code for the two SPROCs below (This is actually simplified to represent the problem, so please don't spend lots of time explaining alternative ways of writing the function/sproc.)

Table Valued Function
SELECT categoryName, categoryID FROM categories
SPROC "getUnusedCategories"
SELECT categoryName, categoryID FROM CategoryInstances cI
FROM dbo.SMAN_getCategories(@SiteMANID, @SectionID) c
LEFT JOIN @EntityResultsTable er

View 2 Replies

DataSource Controls :: Eliminate Returning Of Empty Table From Stored Procedure

Jul 12, 2010

I have a Procedure which should return only 1 Record on selecting record according to Priority.

DECLARE @Accounts nvarchar(MAX)
SELECT @Accounts = ISNULL([map_user_modules].[Accounts], '') FROM [map_user_modules]
WHERE [map_user_modules].[id_user] = 231 AND [map_user_modules].[id_module] = 5
IF ((@Accounts = '') OR (@Accounts = 'All'))
SELECT @Accounts = null

Select @@ROWCOUNT as Priority2

Select @@ROWCOUNT as Priority3

Select @@ROWCOUNT as Priority4

In the above statement Suppose we take a scenario where Select @@ROWCOUNT as Priority3 is executed, I get two tables returned, One is the Table returned by Select @@ROWCOUNT as Priority3 and the other is the Table returned by Select @@ROWCOUNT as Priority2 which has no Records. How can I eliminate the Empty table that returns no records.

View 1 Replies

DataSource Controls :: Stored Procedure Returning Null But Executes At SQL Server

Jul 1, 2010

I am using
SqlHelper.ExecuteDataset(MyConnectionString, CommandType.StoredProcedure, "GetInformation", new SqlParameter("@ID", ID));

In my stored Procedure, I am doing a lot of calculation with joins and it took 19 sec to execute at my sql Server 2008. My application had been working perfectly for 5 days but now as database increases, I found a problem that my connection is breaking at that point. At Sql Server, it execute fine but when I add a breakpoint and watch the stored procedure is returning null.

View 2 Replies

DataSource Controls :: How To Get A Single Value Out Of A Stored Procedure Recordset And Store It In A Variable

May 19, 2010

Here's a stored procedure I created that uses another stored procedure inside it to return a value:


Note the 'exec dirinfo.dbo.d_searchempbyname @TicketSubName' part. That stored procedure will return a single record. What I need is to get a single column from that recordset (in this case, the email address of the employee), and store that value in a variable.

View 3 Replies

DataSource Controls :: Linq And Stored Procedure ?

Mar 2, 2010

I have created one stored Procedure as


I am not getting the result with extra column c.I am not getting what is the Problem.In sql server,It's working fine.

View 2 Replies

DataSource Controls :: Run Stored Procedure Using Linq?

Feb 12, 2010

Is it posible to run a stored procedure using linq? I dont mean one that returns a table i just mean one that runs a set of transactions exec sp_MyProc @Var or something?

View 1 Replies

DataSource Controls :: Using LINQ Passing The Name Of The Stored Procedure Dynamically?

Feb 23, 2010

I have an application where depending on what the user selects run a different stored procedure.

I am using LINQ and am passing the stored procedure name into a sub that will run the stored procedure and return values that I am loading into a DDL.

For example I want to pass the procedure name "GetProducts_Hats" to the sub and not hardcode it.

Protected Sub LoadParamDropDowns(
ByVal SqlObjToExec
String )

I am passing the storedprocedure name in parameter SqlObjToExec

so instead of

values = mydb.GetProducts_Hats

I want to code it to be a variable

values = mydb.SqlObjToExec

But the above code does not work.

View 7 Replies

Web Forms :: Using Single Stored Procedure For Select Insert Update Edit Delete In Linq

Feb 25, 2016

I have a table and i want to use this table in page

how i will call the stored procedure on the basis

of Stored procedure's Action .
FirstName varchar(50) ,
LastName varchar(50) ,


View 1 Replies

DataSource Controls :: Sending A String To Stored Procedure Using An IN

May 18, 2010

I am confused here as to how to handle this. I have a stroed procedure that using the IN clause like so:


Now, partners can be either a single partner ID like so: 12345 or it can be many like: 12345, 22222, 33333Here is the sqlDataReader from my code:


When partner_list contains only one partner id like "12345" it works fine. If it has more than one then the DataReader states that there are no rows in the reader? I also tried to send the dealer list as a string with ticks, like '12345','22222','33333' but that doesnt work either.

View 6 Replies

DataSource Controls :: Stored Procedure Count To String

Jun 27, 2010

I have a several count stored procedures that are binding to gridview nicely for individual items. I now want a ful count of row so I use a stored procedure with:


Which works fine when testing in the DB and returns results like it should. My problem is that for the life me I cannot work how to display the results to a Label.Text or how to do it when my calendar has posted back thats where @LogDate comes from).

View 8 Replies

DataSource Controls :: Passing Query String Value To Stored Procedure

Mar 30, 2010

I'm trying to pass the text value of a text box as a query string value to a stored procedure. I was hoping someone could point me in the right direction. Button Code:


Stored Procedure:


The results page datalist:


Code Behind of results page:


I'm sure i've got this entirely backwards. However if I change the NULL value in the stored procedure with some string value (eg."Donkeys") it pulls all the values that contain "Donkeys" into the datalist on my results page.

View 2 Replies

DataSource Controls :: Execute Stored Procedure Using A String Variable

Jun 22, 2010

Is it possible to save execute stored proc command in a string variable and then execute string variable?
Does this logic fits into LINQ2SQL? Why I want to do this - INstead of passing user control references to server, I want to save user control values to string in client side java script and then pass string to server to do actual stored proc execution. Hopefully this will improve performance.

View 3 Replies

DataSource Controls :: ADO.Net (C#) Connection String - Update Stored Procedure

Feb 24, 2010

My question is: I have update stored procedure in my database (simple update stmt) I am finding difficulty in writing a ADO.Net(C#) connection string for update stored procedure. i have 4 columns and i first 3 columns have constant values. The 4th column values needs to be updated. At the same time i need to increment and then update the table.

View 2 Replies

DataSource Controls :: ObjectDataSource Sorting And Paging In Gridview Using LINQ Stored Procedure Methods?

Jan 31, 2010

I started learning LINQ, So i thought of just creating gridview with sorting and paging using objectdatasource using LINQ. So i got this link

[URL] which Brian Orrel tell us how to do using IQueryable Interface. but i have nearly 300 lines of stored procedure which joins nearly 20 tables. so i thought of creating a stored procedure and using that instead of IQuerytable.


View 7 Replies

ADO.NET :: Linq To SQL Stored Procedure Returning Out Parameter "ref"

Dec 18, 2010

I always have this problem returning an out parameter from sql server using linq. So I have to use other means may be dataset. The following is the stored procedure: ALTER PROCEDURE [dbo].[InsertIntoTestProfile]

View 3 Replies

DataSource Controls :: How To Convert The Oracle Stored Procedure To Sqlserver 2005 Stored Procedure

Apr 2, 2010

This is surareddy. i nead some small clarification in the "Stored Procedure"

how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.

right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.

how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure

View 4 Replies

DataSource Controls :: Do Not Use Or Call Any Stored Procedure But It Says "Could Not Find Stored Procedure 'xxxxx'?

Dec 9, 2010

Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?

View 4 Replies

Multiple Single-result Sql Server Stored Procedures Or Single Multple-result Stored Procedure?

Aug 9, 2010

Background: I use stored procedures exclusively for an ASP.NET application. I am using a DataReader to load a dataset object.

View 4 Replies

DataSource Controls :: Execute A Stored Procedure Within A Stored Procedure?

Jan 18, 2010

Does anybody if it is possible that a stored procedure returns rows which is the result of the execution of another sp? Something like..


View 11 Replies

Copyrights 2005-15, All rights reserved