output-parameter

How to get output parameters from MySQL stored procedure in Rails?

拈花ヽ惹草 提交于 2019-12-03 15:19:47
I'm trying to get a output parameter from MySQL stored procedure, let's have look a example below: 1 In mysql I created this procedure and it works. CREATE PROCEDURE sp_name (out id int) Begin select id into @id from table order by id desc limit 1; End mysql> call sp_deduct_credit_and_money(@id); Query OK, 0 rows affected (0.01 sec) mysql> select @id; +--------------+ | @id | +--------------+ | 24 | +--------------+ 1 row in set (0.00 sec) 2 Therefore, it also works in Rails, BUT it won't return any value for me: ActiveRecord::Base.connection.execute("call sp_name(@id)") ActiveRecord::Base

Is it bad practice to have an output parameter in a method in a WCF service?

眉间皱痕 提交于 2019-12-03 06:48:50
I'm looking for reasons beyond the usual "out parameters are confusing and indicate the method is doing more than one thing"-style arguments and more about what is specifically bad about output parameters in WCF services. Where I work now, we have a rule against them in WCF services, and I'm trying to work out why! Joe B. Personally, I use out parameters in specific places (such as methods named TryParse()). So, I have some of the bias you talked about where I only use it in specific, limited places. In addition, you can't assume that a .Net application is going to be consuming this on the

How to pass output parameter to a Stored Procedure?

折月煮酒 提交于 2019-12-03 03:15:10
I have written a stored procedure with the following format: ALTER PROCEDURE usp_data_migration (@sourceDatabase varchar(50), @sourceTable varchar(50), @targetDatabase varchar(50), @targetTable varchar(50), @finaloutput varchar(max) output) AS BEGIN ----Set of SQL Blocks END Then, I am executing the procedure: DECLARE @finaloutput1 varchar(300) EXEC usp_data_migration 'Yousuf', 'emp', '[City Branch]', 'emp_tgt', @finaloutput1 output SELECT @finaloutput1 By executing this way I don't proper output. When I execute this way: DECLARE @finaloutput1 varchar(300) EXEC usp_data_migration

Retrieve Stored Procedure Output Parameters in Entity Framework always null

三世轮回 提交于 2019-12-02 05:54:14
问题 C# code public List<searchProducts_Result> GetProducts() { var nameParam = new ObjectParameter("numbers", typeof(int)); List<searchProducts_Result> listobjs = new List<searchProducts_Result>(); ObjectResult<searchProducts_Result> objResult = null; searchProducts_Result outParam = new searchProducts_Result(); using (var db = new SPWebEntities()) { objResult = db.searchProducts("asd", 2, 5, "15", nameParam); if (nameParam.Value != null) outParam.UserID = nameParam.Value.ToString(); else

Retrieve Stored Procedure Output Parameters in Entity Framework always null

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 23:58:04
C# code public List<searchProducts_Result> GetProducts() { var nameParam = new ObjectParameter("numbers", typeof(int)); List<searchProducts_Result> listobjs = new List<searchProducts_Result>(); ObjectResult<searchProducts_Result> objResult = null; searchProducts_Result outParam = new searchProducts_Result(); using (var db = new SPWebEntities()) { objResult = db.searchProducts("asd", 2, 5, "15", nameParam); if (nameParam.Value != null) outParam.UserID = nameParam.Value.ToString(); else outParam.UserID = "0"; listobjs.Add(outParam); foreach (searchProducts_Result sr in objResult) { listobjs.Add

Output Parameters in Java

非 Y 不嫁゛ 提交于 2019-12-01 21:51:35
问题 With a third party API I observed the following. Instead of using, public static string getString(){ return "Hello World"; } it uses something like public static void getString(String output){ } and I am getting the "output" string assigned. I am curious about the reason of implementing such functionality. What are the advantages of using such output parameters? 回答1: Something isn't right in your example. class Foo { public static void main(String[] args) { String x = "foo"; getString(x);

Output Parameters in Java

痴心易碎 提交于 2019-12-01 21:05:47
With a third party API I observed the following. Instead of using, public static string getString(){ return "Hello World"; } it uses something like public static void getString(String output){ } and I am getting the "output" string assigned. I am curious about the reason of implementing such functionality. What are the advantages of using such output parameters? Something isn't right in your example. class Foo { public static void main(String[] args) { String x = "foo"; getString(x); System.out.println(x); } public static void getString(String output){ output = "Hello World" } } In the above

Laravel Model SQL Server: Get Output Parameters from Stored Procedure

心不动则不痛 提交于 2019-11-29 12:52:39
I want to get the output parameter from my SQL Server stored procedure in the Model of my Laravel, The Stored Procedure is working perfectly in the SQL Server Management tool and also in NORMAL php file but it does not work in LARAVEL MODEL. This is how I am executing the Stored Procedure in the Laravel Model: $id = "123454"; $email = "ABC@ABC.com"; $name = "FName, LName"; $returnval = 1; //My OUTPUT PARAMETER from SP $action = 'ACTION_MESSAGE; $dummy = 0; $client = $request->input('client'); $team_l = $request->input('team'); $contact = $request->input('contact'); $team = $request->input(

ADO.NET calling T-SQL Stored Procedure causes a SqlTimeoutException

前提是你 提交于 2019-11-27 11:55:33
I have a T-SQL stored procedure with the signature CREATE PROCEDURE MyProc @recordCount INT OUTPUT @param1 INT ... When executed directly in Sql Server the procedure runs in under 5 seconds, returning a few result sets amounting to about 100 rows in total. Calling this procedure using the ADO.NET SqlDataAdapter.Fill method to populate a Dataset causes a SqlTimeoutException on the SqlCommand after 3 minutes (the specified timeout interval). Changing the stored procedure so that it no longer has an output parameter, and that the output value required is returned as the last result set, solves

Output parameter in stored procedure in EF

丶灬走出姿态 提交于 2019-11-27 02:48:47
问题 I have an existing database with lots of complex stored procedure and I want to use those procedure through EF 4. I have done the following: Created an EF data object, Customer . Added a Stored Procedure into the EF Right Click on the EF designer and add a function import. Function Import Name - MyFunction , complex type. Resulting code: CustomerEntities entity = new CustomerEntities(); var result = entity.MyFunction("XYZ", ref o_MyString); Now my stored procedure has an output parameter