DataSource Controls :: Accessing The Result Set Of A Stored Procedure - How To Fix This Error

Jul 27, 2010

I'm programming a webpage in ASP.NET which displays a list of students not listed as participants in something, and upon clicking a student name shows you a brief summary of their details, so the user can ensure they're selecting the right person. Each student is identified by a unique ID.

My code currently correctly obtains their ID, adds it as a parameter to my stored procedure and executes the procedure;

[Code]....

However, when I try to access the results, with say dv.Table.Rows[0], I get the following error:

[Code]....

Upon debugging, there don't seem to be any results returned... when running just the stored procedure in SQL Server with the same data, it does return a single row, as expected.

View 2 Replies


Similar Messages:

C# - Accessing The Result Set Of A Stored Procedure, Executed Using SqlDataSource.Select?

Jul 21, 2010

I'm programming a webpage in ASP.NET which displays a list of students not listed as participants in something, and upon clicking a student name shows you a brief summary of their details, so the user can ensure they're selecting the right person.

My code currently correctly obtains their ID, adds it as a parameter to my stored procedure and executes the procedure;

[code]....

However, when I try to access the results I get the following error:

System.NullReferenceException: Object reference not set to an instance of an object.

Upon debugging, there don't seem to be any results returned... but when running just the stored procedure in SQL Server with the same data, it does return a single row, as expected.

How do I access this result so I can bind it to my fields?

(I am working in ASP.NET 3.5 in Visual Studio 2008, with SQL Server 2008.)

View 2 Replies

DataSource Controls :: Repeating Data In Stored Procedure Result?

Jan 27, 2010

I am bulding a dvd catalog and have a table called DVD which holds all my details about each dvd except Genre, Director and Actor as I want more than 1 Genre, Director, Actor per DVD so put these in seperate tables to avoid repeating the data and used a joining tabe to join the tables so the tables I have are

DVD, Genre, Director, Actor, DVDGenre, DVDDirector and DVDActor

I have now written a stored procedure to pull the info about 1 DVD out of all the tables to display on the webpage I have now got the info I want out of the tables but as the data is now in 1 table I have repeating data is there a way to stop the data repeating the stored procedure i have written is

[code]....

View 8 Replies

DataSource Controls :: Xsd And Stored Procedure With Multiple Result Sets

Jun 12, 2010

Just after some advice I have a stored procedure that returns several tables. I then need to loop through the tables and create dynamic gridviews using the data. At the moment this stored proc is called using

[Code]....

I have used an xsd file to populate everthing else, but due to this returning multiple tables i wasn't sure how this works should it just be in its own xsd? as all the oather i just get a datatable where as with this i need a dataset... how this makes sense...

View 2 Replies

DataSource Controls :: Stored Procedure With Multiple Result Sets - Binding To Gridview?

Feb 3, 2011

I am using a sql stored procedure which returns multiple result sets. By default Sql Datasource is binding the first result set to gridview. I want the second result set to be binded. I browsed all the properties in Sql datasource but could not find one to set this.

View 4 Replies

Incorrect Syntax Error When Accessing Remote Stored Procedure?

Jul 23, 2010

I'm still trying to deploy this site, but with every problem I solve, another arises. Anyways - I've set up the database at my hosting to allow remote connections, and it is running Sql Server 2005. On my development machine, I am working with Sql Server 2008.

I've installed the asp.net schema on my hosted database, and have created several users from the ASP.NET web administration interface, as well as tested that the login works. Running the application locally with the remote connection string nets the same results. However - I'm able to run my scripts and generate my tables and stored procedures without errors - but when the site is run I get the following error on all of my .aspx pages that try to access a stored procedure:

Server Error in '/' Application. Incorrect syntax near 'LoadProfileData'. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'LoadProfileData'.

Source Error:

Line 62: adapter.SelectCommand.Parameters.Add("@ProfessionalName", SqlDbType.VarChar).Value = professionalName;
Line 63: DataSet profile = new DataSet();
Line 64: adapter.Fill(profile, "Profile");
Line 65: return profile;
Line 66: }

Is this a possible Sql 2005 vs 2008 issue? I'm hoping someone else has seen this issue in a similar scenario and can point me in the right direction. The server is running asp.net 2.0, 3.0 and 3.5 and IIS 7.0.

Stored Procedure:

Drop procedure CreateDefaultProfile
GO
Create procedure CreateDefaultProfile(@UserName varchar(256))
as
declare @ProfessionalID uniqueidentifier

[Code].....

View 3 Replies

DataSource Controls :: Error In SQL Stored Procedure?

May 11, 2010

I have a button which the admin will click on every new acad year to update the student's study level.

I have written a SP to do this process, however, it was working fine. But I faced problem when I did testing.

This is my student update study level stored procedure:

UPDATE Student
SET acadLevel = (CASE WHEN acadLevel < '3' THEN convert(char,acadLevel + 1) ELSE convert(char,'G') end )
WHERE acadLevel between '1' and '4';

Error: Conversion failed when converting the varchar value 'G' to data type int.

View 5 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 :: 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.

Caller:

[Code]....

Stored Procedure:

[Code]....

GridviewFiller:

[Code]....

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

Sql Server 2005 - Incorrect Syntax Error When Accessing Remote Stored Procedure?

Jul 23, 2010

I'm still trying to deploy this site, but with every problem I solve, another arises. Anyways - I've set up the database at my hosting to allow remote connections, and it is running Sql Server 2005. On my development machine, I am working with Sql Server 2008.

I've installed the asp.net schema on my hosted database, and have created several users from the ASP.NET web administration interface, as well as tested that the login works. Running the application locally with the remote connection string nets the same results. However - I'm able to run my scripts and generate my tables and stored procedures without errors - but when the site is run I get the following error on all of my .aspx pages that try to access a stored procedure:

Server Error in '/' Application. Incorrect syntax near 'LoadProfileData'. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near 'LoadProfileData'.

Source Error:

Line 62: adapter.SelectCommand.Parameters.Add("@ProfessionalName", SqlDbType.VarChar).Value = professionalName;
Line 63: DataSet profile = new DataSet();
Line 64: adapter.Fill(profile, "Profile");
Line 65: return profile;
Line 66: }

Is this a possible Sql 2005 vs 2008 issue? I'm hoping someone else has seen this issue in a similar scenario and can point me in the right direction. The server is running asp.net 2.0, 3.0 and 3.5 and IIS 7.0.

View 1 Replies

DataSource Controls :: When Use ##Temp Table In Stored Procedure, It Gives An Error?

Jun 15, 2010

i m using ##Temp Table in stored procedure..it gives this error There is already an object named '##people' in the database.in two codition1.in case of multisession2. if transaction drop in between even i drop Table in Last in stored procedure..what can i use in place of temp table to hold data for a time being

View 1 Replies

DataSource Controls :: Syntax Error When Getting Return Value In C# Asp From Stored Procedure

Feb 26, 2010

I am having syntax issues with in my attemto to get a return value from a stored proc. The s/proc code is Select @@Identity My c# code is:

[Code]....

The next line in the code is where I need to assign the return value from the stored proc to a variable;

View 5 Replies

DataSource Controls :: Catch An Error From A SqlDataSource Stored Procedure?

Sep 27, 2010

I have a stored procedure that creates a dynamic query. Sometimes the query is not built because there are no elements in the dynamic query. When the aspx page loads the SqlDataSource throws an error that the query is malformed. How can I catch this error, and handle it with a default message, before it returns the error to the aspx page?

View 2 Replies

DataSource Controls :: EXECUTE Permission Error On SQL Server 2005 Stored Procedure When Running From The IIS?

Apr 10, 2010

sing VS 2008 at a workstation, I have successfully developed a local, file-system ASP.NET 3.5 website. The wbesite included a membership page with Windows authentication and a web parts page. The SQL Server 2005 ASPNETDB database has been created at an IIS web servr. Using the ASP.Net development server of the workstation, both the membership Membership/WebParts pages at the local website worked very well.

Then, I copied the website to a virtual directory at the IIS web server and creates a remote website for the workstation. Under theASP.NET development server of the workstation, both membership and webparts pages of the remote website at the IIS web server also worked fine.

However, when running these web pages from the IIS web server machine, something wrong happened with the web parts page. (The membership page still worked very well.) For the ASPNETDB database at the IIS web server machine, there is an EXECUTE permission error on an ASPNET stored procedure.

What are the differences between the ASP.NET development server and IIS web sever, which caused the EXECUTE permission error on the ASP.NET S.P.? How to find and fix the errors?

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

[Code]....

View 11 Replies

DataSource Controls :: How To Call A Stored Procedure In Another Stored Procedure

May 13, 2010

i want to return output parameter from 1 storeprocedure. into another stored procedure.

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

ALTER PROCEDURE Login
@CustomerName nvarchar(50),
@Password nvarchar(50) output
As
Select @Password=Password
From Customers
Where Customers.CustomerName=@CustomerName

This is the vb
ALTER PROCEDURE Login
@CustomerName nvarchar(50),
@Password nvarchar(50) output
As
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 :: Call One Stored Procedure In Another Procedure For Search?

May 1, 2010

I want to apply other stored procedure select query on result of first stored procedure.

View 1 Replies

DataSource Controls :: Stored Procedures Are Not Showing Up Correctly In The Stored Procedure Drop Down

Apr 27, 2010

I am using Visual Studio 2008 and SQL Server 2008 and have added a SQL datasource to my form.

When I configure the datasource, I choose my connection string which looks like this in my webconfig:

<connectionStrings>

<add
name="PSFSPRD_ConnectionString"
connectionString="Data

The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.

On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.

I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.

Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?

View 3 Replies

DataSource Controls :: Adding Stored Procedure To Dataset1.xsd Giving Errors "An Unexpected Error Has Occurred"

Jul 31, 2010

i am using paging technique from this tutorial [URL] and it is working fine, i used asp.net 2.0 with sql server 2005 then i upgraded to visual studio 2008, and converted the asp.net 2.0 application to 3.0 and now using sql server 2008 all the existingpages and .xsd files are working, fine, i can see data in .xsd files when i preview it but i cannot add new stored procedures it gives me an error "An unexpected error has occured" Error message:unexpected error i dont know what it is, already configured dataset (.xsd) works fine, it is just that iam unable to add stored procedures to new datasets my connection string

<add name="jobcon" connectionString="Server=HOME-46CTBUROCXSQLEXPRESS; Database=jobdhundo; User ID=; Password=;Timeout=200; Trusted_Connection=True" providerName="System.Data.SqlClient"/>

it is fine with the entire application there is no coding involved

View 14 Replies

C# - How To Convert The Result Of A Stored Procedure In A Dbml File

May 6, 2010

I have a MVC project that has a Linq to SQL dbml class. It is a table called Clients that houses client information. I can easily get the information to display in a View using the code I followed in Nerd Dinner but I have added a stored procedure to the dbml and it's result set is of IQueryable, not IQueryable. I need to convert IQueryable to IQueryable so I can display it in the same View. The reason for the sproc is so I can pass a search string tothe sproc and return the same information as a full list but filtered on the search. I know I can use Linq to filter the whole list but I don't want the whole list so I am using the sproc.

Here is the code in my ClientRepository with a comment where I need to convert. What code goes in the commented spot.

public IQueryable<Client> SelectClientsBySearch(String search)
{
IQueryable<SelectClientsBySearchResult> spClientList = (from p in db.SelectClientsBySearch(search) select p).AsQueryable();
//what is the code to convert IQueryable<SelectClientsBySearchResult> to IQueryable<Client>
return clientList;
}

View 1 Replies

MVC :: Execute Stored Procedure And Pass Result To View

Jun 19, 2010

I created a stored procedure in my MVC project. I need to execute it and pass result to view form. How can I do this?

View 1 Replies

SQL Server :: Assign Result Of Count Stored Procedure To C# Variable?

Aug 7, 2010

I have an aggregate stored procedure (named sp2) that returns a count of records meeting a certain criteria ASrecCount. I am using a DAL per the ASP.NET tutorial and have created a Table Adapter (named
sp2TableAdapter) with GetData and Fill methods. I have a button on an ASP.NET page that launches an event handler. In the button's event handler, I have this line: sp2TableAdapter sp2 = new sp2TableAdapter();
What works so far:

This code will bind the value of sp2 to a data control:

sp2TableAdapter sp2 = new sp2TableAdapter();
DropDownList1.DataSource = sp2.GetData();
DropDownList1.DataValueField = "recCount ";
DropDownList.DataTextField = "recCount";
DropDownList1.DataBind();

When running this page and clicking the button, the numeric value of recCount returned from sp2 is bound to the DropDownList control and 1 row is poplated with the recCount value (in my case 1451).

Problem:
In the event handler, I do not want to bind the value of recCount to a control, but want to to use it in some logic as an integer. What is the C# code that will do this? (In place of the DropDownList control lines above)

View 2 Replies







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