Setting connection information via Metastorm.Runtime.Contracts.Mbo.MboConenctionInfo
Metastorm.Runtime.Core.QueryParameter[] oParams = new Metastorm.Runtime.Core.QueryParameter[1]; oParams[0] = Mstm.SQLArg("@MyParam","some text"); // in here I need to define myConnInfo as // Metastorm.Runtime.Contracts.Mbo.MboConnectionInfo // How do I do this ? Metastorm.Runtime.Contracts.IDataContainer oResults = Mstm.SelectSql(myConnInfo, "EXEC dbo.usp_NewTestBasicTableRecord2 @RowDesc, @RelatedID", oParams); if (oResults.Integer != null) Local.intNewSYSID = oResults.Integer;
You help will be much appreciated
Thanks
Barrie
Comments
-
Hi Barrie,
if you are using your MetastormDefault connection you can set:
Mstm.SelectSql(null, "EXEC dbo.usp_NewTestBasicTableRecord2 @RowDesc, @RelatedID", oParams)
When you set null in the connection parameter the MetastormDefault connection will be used
or
Mstm.SelectSql(new MetastormDefault(), "EXEC dbo.usp_NewTestBasicTableRecord2 @RowDesc, @RelatedID", oParams);
Does this help?
0 -
Thanks for the response - but I want to use my own connection rather than the MetastormDefault connection.
I think I've found another way of providing a return from my stored procedure.
I have created a query Busness Object referring to my connection.
The query is
EXEC sp_myProcedure "@parameter"
The stored procedure returns a table with 1 row and 3 columns
The results of the query are 3 variables, one for each column.
So in my project I can create a server script to refresh the query "query.refresh()"
and set a locla variable to one of the varibles in the results "myLocalVariable = query.resultVariable1"
For more details ( and some of the errors I'm getting when verifying the code) please see another of my posts.
Thanks again for your help - watch this space for the completed and correct code
0 -
On this note of defining your own connections within a server script, you could always ignore using the Metastorm functions and connect to a database using a .NET SqlConnection.
Something like this within your server script: (and I'm winging this by the way)
using (SqlConnection connection = new SqlConnection(ConfigurationManager.AppSettings["BarriesNewConnection"])
{
SqlCommand command = new SqlCommand(connection, "BarriesStoredProcedure");
command.AddWithValue("Parameter1", someValue);
SqlReader reader;
connection.Open();
reader = command.ExecuteReader();
while (reader.Read())
{
someProcessVariable = reader["Column1"].ToString();
}
reader.Close();
connection.Close();
}
You get the idea. :smileyhappy:
Just remember to close and dispose of any sql connections or readers you use within the code.
All the best
Phil
0 -
Just thinking about this again, if you have you new connection setup in the process, call it "TestConnection", can't you just say "new TestConnection()" in the server script for the first parameter of the SelectSql method?
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories