Hi all,
I'm relative new to XPO. We have just ordered a cross update to your enterprise subscription and now i tried out some things with xpo trial.
"Simple" connection to tables etc. works fine, but we have some "specialities" which i don't know to resolve.
we have some stored procedures for special things which do not need any persistant objects or so. only call them and get return parameters. we cannot call them seperately outside xpo because only one connection to the database is possible (embedded database). when i call it seperatly I get an error - too many connections -.
now, i can call the sp's via XPO. but don't know how to get the results!? I tried different things. The last i tried is to create an XPO class which holds the parameters as fields like:
[NonPersistent]
public class JVInfo : PersistentBase
{
string fPID;
public string PID
{
get { return fPID; }
set { SetPropertyValue<string>("PID", ref fPID, value); }
}
int fKID;
public int KID
{
get { return fKID; }
set { SetPropertyValue<int>("KID", ref fKID, value); }
}
string fVID;
public string VID
{
get { return fVID; }
set { SetPropertyValue<string>("VID", ref fVID, value); }
}
public JVInfo(Session session) : base(session) { }
public JVInfo() : base(Session.DefaultSession) { }
public override void AfterConstruction() { base.AfterConstruction(); }
}
Then i call the sp as follows:
public void LoadCP(Session session)
{
XPClassInfo myClassInfo = Session.DefaultSession.GetClassInfo(typeof(JVInfo));
session.GetObjectsFromSproc(myClassInfo,"SP_CP");
XPMemberInfo member = myClassInfo.FindMember("VID");
}
But how do I get the value of the parameter VID? I don't find it? "GetValue" has not value as it says member is no collection. but there's no need of collections. only single parameters.
Here's my "Old Call" for better understanding:
FbConnection cnnConnection = new FbConnection("ConnectionString");
FbCommand cmd = new FbCommand("SP_CP", cnnConnection);
cmd.CommandType = CommandType.StoredProcedure;
FbParameter p = cmd.Parameters.Add("@PID", FbDbType.VarChar);
p.Direction = ParameterDirection.Output;
p = cmd.Parameters.Add("@KID", FbDbType.Integer);
p.Direction = ParameterDirection.Output;
p = cmd.Parameters.Add("@VID", FbDbType.VarChar);
p.Direction = ParameterDirection.Output;
cnnConnection.Open();
cmd.ExecuteNonQuery();
if (cmd.Parameters["@PID"].Value.ToString() == "blabla")
{
DO SOMETHING;
}
Is there a simple example available how to call stored procedures and get the result parameters?
Thank you for your help
Juergen
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hi Juergen,
Thank you for your question. You can use the Session.ExecuteSproc method, if you do not want to define a persistent object to obtain the result of executing a stored procedure. Please try this solution, and let me know whether it meets your requirements.
Thanks,
Uriah.
Hi Uriahm
thanks for your help. That works fine for me!
Juergen
You are welcome, Juergen!
Please do not hesitate to contact us again, if you experience any difficulty when using our components.
Thanks,
Uriah.