I am curious if anyone has returned output from a stored procedure via script within a business process? I found one process with a script task that uses the StoredProcedure object to execute the stored procedure, but nothing to capture the output. Is this possible under the bpm online platform objects?
CalcForecastFactPotentialProcess
if (ForecastId != Guid.Empty) {
StoredProcedure storedProcedure = new StoredProcedure(UserConnection, "tsp_RecalculateForecastFact")
.WithParameter("ForecastId", ForecastId) as StoredProcedure;
storedProcedure.PackageName = UserConnection.DBEngine.SystemPackageName;
if (CurrentUserContactId != Guid.Empty) {
storedProcedure.WithParameter("CurrentUserContactId", CurrentUserContactId);
}
storedProcedure.Execute();
CreateReminding();
}
return true;
Using Reader
SqlConnection connection = new SqlConnection(ConnectionString);
command = new SqlCommand("TestProcedure", connection);
command.CommandType = System.Data.CommandType.StoredProcedure;
connection.Open();
reader = command.ExecuteReader();
List TestList = new List();
Test test;
while (reader.Read())
{
test = new Test();
test.ID = int.Parse(reader["ID"].ToString());
test.Name = reader["Name"].ToString();
TestList.Add(test);
}
Use DataTable
SqlConnection connection = new SqlConnection(ConnectionString);
command = new SqlCommand("TestProcedure", connection);
command.CommandType = System.Data.CommandType.StoredProcedure;
connection.Open();
DataTable dt = new DataTable();
dt.Load(command.ExecuteReader());
gvGrid.DataSource = dt;
gvGrid.DataBind();
Steve