DataSource Controls :: Dynamically Change Store Procedure?
May 7, 2010
I am using SqlDataSource control to query my data via store procedure. Based on which option the user picked from the RadioButtonList control, I want to dynamically at run time to choose which store procedure gets executed. How do I do this? I am already using Query String for my parapmeters. I can could use this for the store procedure as well. The problem is, how do I get the SelectCommand to pick the store procedure name from the parameter passed in the URL?
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?
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')
When I try to create a stored proc in SQL Server Express 2008 by right clicking on the Stored Procedures folder of my database and selecting New Stored Procedure, then attempt to save, it saves the procedure as a SQL query in the projects folder instead of saving it as a stored procedure in the Stored Procedures folder of my database.
i am a new bee in SQL Server 2005. I have a stored procedure that accept two parameter , variable @ColumnName as column name and @SearchText as search text.
My stored procedure is written as below:
[Code]....
but the error i get is "The 'usp_GetPlantTest' procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead."
Here's a stored procedure I created that uses another stored procedure inside it to return a value:
[Code]....
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.
My insert is adding a record to the database in the call to the stored procedure in SQL Server, but a -1 is returned - Shouldn't it return 0 if the insert/update was successful?
I want to pass the Array ( object[]) or Structure data type value to the store procedure through ibatis .net. I can do same by commandtext using SQLDBType.Structure. I am using Table value function in sql server 2008 and .Net 2010.
Here is the code copied from [URL] In asp.net code behind, I use try-catch try to catch any error but never catch it. In SQL database, if I rename Employees to Employeesx or change column DepartmentID to DepartmentIDx, record will not be deleted (it is right) without any error (it is wrong, suppose catch an error).
CREATE PROCEDURE DeleteDepartment ( @DepartmentID int ) AS BEGIN TRANSACTION DELETE FROM Employees WHERE DepartmentID = @DepartmentID IF @@ERROR <> 0 BEGIN ROLLBACK RAISERROR ('Error', 16, 1) RETURN END DELETE FROM Departments WHERE DepartmentID = @DepartmentID IF @@ERROR <> 0 BEGIN ROLLBACK RAISERROR ('Error', 16, 1) RETURN END OMMIT
I would change the filterexpression depending to the choice of some DropDownList but, i've tryed with ObjectDataSource_Filtering event but it seems that non reevaluate the filter.is it the right event?i've to do any other operations after changing the filterexpression?
Is it better to store images directly in a database or to just store the name of the file in the db and display that file? I would think that just storing the filename of the image would keep the db size low...
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?
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.