Set Sessions To Resultset Returned From Store Procedure?
May 17, 2010
I have a procedure that im going to be calling on my page load, i will pass an id to it and it will return up to 6 records. I need to set a session for each record returned.
Can i do that within my page_load event to pass the value, and set the sessions?
If no results are returned, then that session will be 0. So in other words, regardless there will always be 6 sessions that need to be set, either with the results returned or with 0.
View 22 Replies
Similar Messages:
Mar 11, 2011
My SQL stored procedure returns 3 different datasets as follows:
team_id name
1 Team1
2 Team2
...and more
location_id name
1 Dallas
2 New York
...and more
branch_id name
1 Austin
2 New Jersey
...and more
How do I put this data into one Dataset so that I can loop through the data and manipulate it?
View 1 Replies
May 6, 2010
Stored procedure:
[Code]....
This code returns MdaID and StateID, I want to assign them in this manner:
MdaIDLabel.Text = MdaID and StateIDLabel.Text = StateID, but I am not sure how to separate the two values and then to assign them as I have indicated above. Since my function has a "void" return -
MdaIDLabel.Text = GetMdaState({0}, 64114);
StateIDLabel.Text = GetMdaState({1}, 64114); - will not satisfy the requirement.
I am working with VS 2008 VWD, .NET 3.5 SP1, C#, SQL Server 2008 Express
View 3 Replies
Mar 6, 2011
I get a single value from a stroed procedure of type float. Even if I change it into Int or decimal in the procedure when I call it from my asp.net appliction with ExecuteScalar I get this error:
Exception Details: System.InvalidCastException: Object must implement IConvertible.
Source Error:
[Code]....
I tried with
Int32 pomalor=(int32)distpostSqlCommand1.ExecuteScalar();
= Convert.ToString(...);
= (String).....
but I always get the same error.
View 7 Replies
Mar 30, 2010
I have a stored procedure 'RoomIfExists' on my sql server (it does work). It takes a string variable for the Room_No and returns either '1' or '2' depending on the result of the query.
[Code]....
I need to know how to run the sp in c#, passing the variable Room_No and then pull the result from it.I am using a data reader.
View 2 Replies
Feb 10, 2011
I have a stored procedure which returns a table. The stored proc is called via a linq datacontext.
It works fine and I get the table back however I really want to also get the title relating to each particular cell returned.
The stored procedure call is like:
var table = DataContext.GetTable().ToList();
So I get a List<GetTable>. The data is fine I just want the column names as well.
View 2 Replies
May 11, 2010
inside procedure, how to know a sql returned records or not?
View 7 Replies
Apr 23, 2010
This may not be the correct place to put this as it is both a stored procedure AND Visual Studio 2008 problem.
I have the following stored procedure:
[Code]....
I have been mokeying around with it because of what is happening. I have a dataset, call it dataset1. I drag this stored procedure onto the dataset. I EXPECT a datatable to appear, instead the data set adds this store procedure to the queries table adapter and sets the exec mode to 'NonQuery' which unless I am very mistaken, means "don't expect a dataset back from this' when in fact you DO expect a dataset back from this.
The SQL server is a Windows 2000 Server running SQL 2000. It has never caused us a moments grief since we set it up oh-so-many years ago.
If I connect to a different database and drag a query into the same dataset I get a datatable as I expect. I cannot see where / how this procedure could be wrong. The query when executed returns exactly the data I expect, in the format I expect (looks like a table, acts like a table in the Query analyzer).
View 3 Replies
Sep 10, 2010
I am working on creating a stored procedure that will output a pivot table. In the pivot table will be either the string NULL or a number. How can I reformat this in ASP.NET so the NULL value becomes a blank cell in the gridview and the number (whatever it is) becomes an 'X' ?
View 3 Replies
Nov 25, 2010
I have a stored procedure in my database to update table. I need find the value from the gridview and pass them to the store procedure. When I call the stored procedure from VB.net, error appears "could not find stored procedure". I am sure the store procedure is there.
My code is
The store procedure
[Code]....
My code in VB.net
[Code]....
View 1 Replies
Mar 2, 2011
HOw I can show the store procedure result is the drop down?
View 4 Replies
Mar 12, 2011
I am creating an ASP.NET Wiki for myself to track the knowlege I gain in C# and other language.
I have created a Stored Procedure to insert a category into a DB, the DB has two fields C_ID(int) and Category(varchar 25). In my ASP page, there is no field for C_ID, it increments automatically by IsIdentiy = true;
When I try to excute it, it fails. What is the best approach to handle this?
Code:
ALTER PROCEDURE dbo.InsertCategory
@ID int,
@CATEGORY varchar(25)
AS
INSERT INTO Wiki
(C_ID, C_Category)
Values (@ID, @CATEGORY)
/* SET NOCOUNT ON */
RETURN
Did I miss something to insert from the .aspx page?
try
{
//create a command object identifying the Stored Procedure
SqlCommand cmd = new SqlCommand("InsertCategory", conn);
//Set the command type
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("Category", txtAddCatagory));
cmd.ExecuteNonQuery();
View 2 Replies
Feb 25, 2010
i want to put the output of store procedure in ImageUrl
this is behind code, i wrote it on onclick event of asp:image
Pic is the name of a folder in root of site , i want to put the output of store procedure in Eval:
Image1.ImageUrl("~/pic/"+Eval(" " ));
View 2 Replies
Feb 8, 2010
I had a little problem with the value that one of my SPs returns. In my SP, I create some temporary tables to store certain data from multiple tables and contains some queries for an advanced calculationBut precisely yesterday, the value that the SP returns was incorrect. I tried to look at the SP and the data again and everything was OK, but not the result from the SP.And what the heck!!..today the value is totally right ...I truly have no idea what's wrong with the SP..Is there anyone knows what the root of cause is?
View 4 Replies
Oct 5, 2010
I have several store procedure to do different things. When user click submit button, call store_procedureOne, store_procedureTwo, store_procedureThree.
Here is my code.
protected void ButSubmit_Click(object sender, EventArgs e)
{
OleDbConnection myConnection = new OleDbConnection(connStr);
OleDbCommand myCommandUpdate = new OleDbCommand("store_procedureOne");
myCommandUpdate.Connection = myConnection;
myCommandUpdate.CommandType = CommandType.StoredProcedure;
myConnection.Open();
myCommandUpdate.ExecuteNonQuery();
myConnection.Close();
Server.Transfer("NextPage.aspx", true);
}
I do not know how to add store_procedureTwo and store_procedureThree at
OleDbCommand myCommandUpdate = new OleDbCommand("store_procedureOne");
View 2 Replies
Jul 16, 2010
I created a CR which data source is a store procedure. Within the store procedure there is one parameter. How to pass a value to the parameter and display CR on the screen?
View 1 Replies
Jun 22, 2010
I have another post on formatting arrays [URL], thinking that would be the way.. and may be it is.. But let me explain it here and see if thats where i need to focus. I have a class that i use to call 3 different procedures, the values from proc#1 are passed to proc#2 and then proc#2 values passed on to proc#3. Now my problem is that i need the results from proc#3 to be placed in a variable i can pass on to another procedure to execute a query.
Proc#1 returns only 1 record. (easy to place into a session or variable)
Proc#2 returns only 1 record. (easy to place into a session or variable)
Proc#3 returns multple records(its only 1 field that is returned, but can have multiple records), so i need to know what is the best solution to place all records returned into a session or variable to use as a parameter in a query?
Since i need to pass those values to a stored procedure, how can i pass what is returned from proc#3 to my query? One of the parameter of the store procedure is our locations, so my query will look like this:
Select *
From tblName
Where loc LIKE ('1','2','3' )
So i want to set it up so that the values within the LIKE statement are passed in from the page like so
Select *
From tblName
Where loc LIKE (@loc)
View 6 Replies
Apr 14, 2010
I have a sql which the data read from the store procedure is very dynamic.
i have finish the first part of the sql in stored procedure but having problem in executing it.
[Code]....
How do i use EXECUTE SP_EXECUTESQL to do this??
View 2 Replies
Oct 12, 2010
is there a function for adding days to a date value within a stored procedure?If I had a field with a start date and a field for duration which would be how many days the even lasts....like if I wanted something like this:TableName.StartDate, DateAdd(TableName.StartDate, TableName.Duration) as EndDate, etc
View 4 Replies
Sep 29, 2010
I have to open a batch file automatically in sql. So i have used the below command.EXECUTE master.dbo.xp_cmdshell 'D:Databasesatch123.bat'Its worked for few times. After that its not working.One time i have stopped before the process is complete.May be this is the issue.Now its returns null value.
View 4 Replies
Feb 25, 2010
I want to correspond the output of a store procedure to the image onclick event I mean here:
protected void imageLoaded(object sender, EventArgs e) {
Image1.ImageUrl("~/pic/"+Eval(" " )); }
I don't know what I should write in Eval.
View 7 Replies
May 19, 2010
I want to execute a Store Procedure and then get the Output in one table. However I am not getting the query. I want something like this execute 'Stored procedure name' 'param1','param2','param3' and then get the result into some table. Is this possible?
select * into #table from (execute 'Stored procedure name' 'param1','param2','param3')
View 1 Replies
Apr 27, 2010
I have store procedure: ALTER PROCEDURE dbo.GetAllInfoFromUsers(@name varchar(50)) AS select id, userName,password, role from tbl_users where userName=@name
Then I have Report.aspx page:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
AutoDataBind="True" Height="1106px"
Width="876px" />
[Code]....
I have dataset (MyDataset) build out of store procedure. and I have StoreCrystalReport.rpt linked to MyDataset.
I am unable to see the filtered output in crystal report.
View 4 Replies
Jan 1, 2010
storeprocedure code:
ALTER PROCEDURE sp_CheckForDuplicates
(
@UserName VARCHAR(50) = NULL,
@FirstName VARCHAR(50) = NULL,
-----------------------------
Error show :if (objReturnPara>0)
[Code]....
operator '>' cannot be applied to operands of type 'object' and 'int'
operator '>' cannot be applied to operands of type 'object' and 'int'
View 14 Replies
Jul 13, 2010
I have been working a in a function to send all the properties of a class to a store procedure in any DB. I made it work when i define the specific class in the declaration of the function like this:
protected Boolean LoadDataDB(Class1 objClass1,Type t,String StoreProc)
But what i want is to make this function as generic as posible. I thought on replace the "Class1 objClass1" part with something like "object obj" but it didn't work. If Ipull this of, it will be very usefull for me. Up next i'm copying what i have so far.
[Code]....
The error appears in the wrap.AddInParameter line, in the following code:
objeto[Prop.Name.ToString()]
And it says something like "Can not apply indexing with [] to an expression of type object"
View 2 Replies