Forms Data Controls :: Use Datatable - Getting Results Of Stored Procedure
May 22, 2010Can a datatable be used as shown below when getting the results of a stored procedure. If yes, when would one use a dataset instead?
[Code]....
Can a datatable be used as shown below when getting the results of a stored procedure. If yes, when would one use a dataset instead?
[Code]....
I'm using asp.net 3.5 inc#.
How can I read the data from a stored procedure in Sql Server into a datatable using a datareader.
I am trying to get the results of the variables from a stored procedure to write out somewhere so I can see what values are being passed through for each variable in a button click. Does anyone know how to do that. Here is my code for the button click:
[Code]....
Here is my variables in the stored procedure. The first is the select statement and then the update:
[Code]....
I have a windows aspx form that I have a TextBox, Button and a GridView. The TextBox is stored as a variable @subschedule and passed to a stored procedure. What I'd like to do is to populate the results of that procedure into my GridView.
View 3 Replies[Code]....
i have a stored procedure with this values and i need just to make a button that will send something to "Equip" column,how to do it? write the values on my webpage and make a button to exec the procedu
When Select an entity by linq with entity framework 3.5 ...and thenn select it again using stored procedure ..which change the value for a field for that entity ... i got that with old value ...not procedure value...............When i called that procedure before .. the select ... i got the correct value.........but in my case i shall call the procedure after select with linq statment
View 4 Repliesi want data to drop down list using stored procedure .
However im not able to do that.
keeping 1000 records in a datatable in session and do paging using that?
Or
doing paging in stored procedure level and requesting 35 records each time?
more info:
datatable of 40 columns
number of users is 200 users
7 application are running on IIS
Oracle DB server is not the same server for IIS
Edit: the user may update a row, and submit it to database. which will refresh the grid by requesting the whole data from database.
Edit2: Every user is loading different datatable which coming from same table in database
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
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 RepliesI have a dataset that has two datatables. In the first datatable I have EmpNo,EmpName and EmpAddress. In the second datatable I have Empno,EmpJoindate, EmpSalary. I want a result where I should show EmpName as the label and his/her details in the gridview. I populate a datalist with the first table, and have EmpNo as the datakeys. Then I populate the gridview inside the datatable which has EmpNo,EmpJoinDate and EmpAddress. My code is
[Code]....
My Design is
<asp:DataList ID="Datalist1" runat="server" DataKeyField="EmpNo">
<ItemTemplate>
<asp:GridView ID="Gridview1" runat="server">
</asp:GridView>
</ItemTemplate>
</asp:DataList>
I do not get results in the gridview, instead have errors. I tried then placing the bound field
<asp:GridView ID="Gridview1" AutoGenerateColumns="true" runat="server">
<Columns>
<asp:BoundField DataField="EmpNo" />
</Columns>
It throwed an error stating / A field or property with the name 'EmpNo' was not found on the selected data source.
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]....
i want to return output parameter from 1 storeprocedure. into another stored procedure.
View 7 RepliesDoes anyone have an example of using MSChart with a stored procedure? I have a chart control on the web page and have bound it to the stored procedure. I have also set the parameters for the stored procedure. However nothing shows in the chart. All the examples I can find only show adding points one at a time, but this seems to defeat the purpose of binding the chart to the stored procedure.
Some of the problems I am trying to solve:
The stored procedure returns about 6 columns of data. I only need to use two of them. How do I select which of the columns will be displayed in the chart?
I want to use two or more series on the chart. Do I have to run a separate stored procedure for each series or can I make one call to the stored procedure and then display the data in the two series? If so, how?
I am using VS 2008, MS SQL Server 2008, .Net 3.5 and VB .Net.
I have one problem with stored procedure.
My table:
tbl_payments
UserId
PaymentId
PaymentType
Stored procedure:
ALTER PROCEDURE dbo.Select_Customer
@PaymentId varchar(100)
/*
(
@parameter1 int = 5, [code]....
[Code]....
SelectCommand="Execute ClassesSelect" runat="server">
<SelectParameters>
<asp:ControlParameter Type="Boolean" Name="@all" ControlID="chkAll" PropertyName="Checked" />
</SelectParameters>
</asp:SqlDataSource>
i need an example of a paging gridview using stored procedure.
i tried finding on the web and i can't find exactly what i need.
i have a stored procedure i want to display the income of this procedure in a HTML table ona aspx page. It that possible.
[code]....
[Code]....
[Code]....
I want to use the ListView and DetailsView to build a new aspx page
I have designed a database and defined three stored procedures for one of my tables. (one procedure each for Select, Insert & Update). The stored procedures use parameters.
My problem is with the "Define Parameters" dialog box of the SqlDataSource- Configure Data Source procedure.
Specifically, I'm not sure how to use the "Parameter Source" drop down box.
The "Parameters" box on the left correctly lists all of the columns in my stored procedure.
However, when I choose "Control" in the drop down box, the next dialog box asks for the ControlID.
But I want to use either the ListView or the DetailsView and I thought that these two controls somehow "read" the data source and sort of configure themselves.
In a nutshell, I can't find any way to "point" to either the ListView or the DetailsView.
I'm left with the impression that by asking for a "ControlID" for each parameter, the system seems to expect that I have already defined the "to be bound" controls before I can use the stored procedure.
So I'm wondering if it is the case that ListView and DetailsView don't work with stored procedures. True or False? Or is there some way of making this happen?
I'm tring to populate a datagrid using a stored procedure that returns about 20 fields (this part I figured out), but the kicker here is that for this one particular page I only want to display about 6 of those 20 returned fields.
I did find on passing the procedure the parameters that are required, and populating the datagrid, but haven't found anything (not that I can tell) that explains how to only view certain fields that have been returned.
I'm using VS 2008 and VB for my coding against a MS SQL 2008 server. All of the stored procedures are working with current windows applications.
The update option is using a stored procedure. There are no parameters fro the SP but the error message is saying that parameters are expected. If executed as SQL string then it works OK. I need to use a SP as other updates are required. Code: THIS WORKS
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:appConnectionString%>"
ProviderName = "<%$ ConnectionStrings:appConnectionString.ProviderName %>"
SelectCommand = "SELECT * FROM [qryNewManifestSub] where manifestid = 6855"
InsertCommand = "INSERT INTO [qryNewManifest] ([LocationId], [ManifestDate],
[RouteId], [VehicleType], [ManifestType])
VALUES (@LocationId,
CONVERT(DATETIME,@ManifestDate,103), @RouteId, @VehicleType, @ManifestType)"
UpdateCommand = "INSERT INTO dbo.tbl_DEBUG
(ManifestId, ManifestTripId, LocationId, Manifestdate, RouteId, VehicleType, ManifestType)
VALUES (1,2,3,'01/01/2010',4,5,6)"
UpdateCommandType="Text"
DeleteCommandType="Text">
<InsertParameters>
<asp:Parameter Name="LocationId" Type="Int32" />
<asp:Parameter Name="ManifestDate" Type="DateTime" />
<asp:Parameter Name="RouteId" Type="String" />
<asp:Parameter Name="VehicleType" Type="String" />
<asp:Parameter Name="ManifestType" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource
This does not work Error Message - parameters expected but none given
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:appConnectionString%>"
ProviderName = "<%$ ConnectionStrings:appConnectionString.ProviderName %>"
SelectCommand = "SELECT * FROM [qryNewManifestSub] where manifestid = 6855"
InsertCommand = "INSERT INTO [qryNewManifest] ([LocationId], [ManifestDate],
[RouteId], [VehicleType], [ManifestType])
VALUES (@LocationId,
CONVERT(DATETIME,@ManifestDate,103), @RouteId, @VehicleType, @ManifestType)"
UpdateCommand = "usp_TESTSP"
UpdateCommandType="StoredProcedure"
DeleteCommandType="Text">
<InsertParameters>
<asp:Parameter Name="LocationId" Type="Int32" />
<asp:Parameter Name="ManifestDate" Type="DateTime" />
<asp:Parameter Name="RouteId" Type="String" />
<asp:Parameter Name="VehicleType" Type="String" />
<asp:Parameter Name="ManifestType" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
Stored Proc
usp_TESTSP
This SP has been tested and works OK
USE [TMSWEBALL]
GO
/****** Object: StoredProcedure [dbo].[usp_TESTSP] Script Date: 10/06/2010 14:03:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_TESTSP]
As
BEGIN
SET NOCOUNT ON added to prevent extra result sets from
interfering with SELECT statements.
SET NOCOUNT ON;
*/
INSERT INTO dbo.tbl_DEBUG
(ManifestId, ManifestTripId, LocationId, Manifestdate, RouteId, VehicleType, ManifestType)
VALUES (1,2,3,'01/01/2010',4,5,6)
END
>
I have gone through all of the forums and couldn't find an answer to my problem, which is:: I need to bind a result from a stored procedure to a label. What I have done so far is to try to use <%# Bind(SP_Result_FIeld_Name)#> and that does nothing. I also tried to assign the results to a string in the code behind, all that did was put the words "TTLCount" in my label. Part of the problem might be that it is pulling from a temp table and the field I'm pulling has an assigned name ( Count(*) as TTLCount)... The rest of my SP is returning to a gridview which works fine. I just need to display the total number returned and the total number of returned that have email addresses. Here is what I have so far::
[Code]....
I'm pretty new at web programming but a lot of years as a client-server dev.
I'm populating a gridview from a stored procedure, but I don't want to actually execute the populate till I have all the values filled in the page. (some are static textboxes, a calendar (date) value and some drop-downs that are populated earlier) I see there's nothing like gridview1.show() like there is in c# windows form programming. I tried
[Code]....
[Code]....
I have a listbox which I need to populate with the results from a stored procedure. I have a class Ethics and I can call my stored proc there but I don't know how to populate the listBox from this point on. Here's what I have so far:
[Code]....