on 06-04-2004 8:16 AM
Hi, Have anyone been able to make and use a single sign-on connection using C#?
I successfully make the connection til the client and just after that I make the single-signon (As the UI-reference exsampel does). This single-signon is succesfully, but when I use the SAPBobs-company which I connected, in an event the company-object is corrupted (A Simple debugging fails for some reason)...
Anyone been able to use this feature with C#
This exsampel show the problems (see the comments in code on the event-handler method)
public SAPbobsCOM.Company c = new SAPbobsCOM.Company();
public SAPbouiCOM.Application app;
public SAPbouiCOM.SboGuiApi gui = new SAPbouiCOM.SboGuiApiClass();
private void Form1_Load(object sender, System.EventArgs e) {
//Connect til SAP
try {
//Henter connection-string fra commandolinie og laver connect til SBO (gui)
gui.Connect(Environment.GetCommandLineArgs()[1]);
try {
//Vælger SBO (Hvis flere kørende)
app = gui.GetApplication(-1);
}
catch(Exception exp) {
throw new Exception("Fejl under oprettelse af Application: "+exp.Message);
}
}
catch {
throw new Exception("SBO er ikke startet. Start det og prøv igen");
}
string cookie = c.GetContextCookie();
string conStr = app.Company.GetConnectionContext(cookie);
if(c.Connected) {
c.Disconnect();
}
if(c.SetSboLoginContext(conStr) == 0) {
c.Connect();
}
//Call methos that use company
normal_method();
//Registration Eventhandlers
app.MenuEvent+=new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(app_MenuEvent);
}
private void app_MenuEvent(ref SAPbouiCOM.MenuEvent pVal, out bool BubbleEvent) {
BubbleEvent = false;
//At this point c is corrupted (In a watch all properties is "error: cannot obtain value string")
if(c.Connected) {
MessageBox.Show("Test");
}
//Also if i try this alle properties in c2's watch is "<error: an exception of type: {System.InvalidCastException} occurred> SAPbobsCOM.BoSuppLangs"
SAPbobsCOM.Company c2 = new SAPbobsCOM.Company();
}
private void normal_method() {
if(c.Connected) {
MessageBox.Show("Test2");
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rasmus,
I was wondering have you been able to succesfully use the DI SDK at the same you use the UI SDK in C#? I have no problems using the UI SDK but if I try to any objects inside the DI I get an IQuery interface problem. I can succesfully use the DI SDK when not using the UI SDK. Is anyone using both SDKs sucessfully at the same time in C# using version 6.5?
Lita
User | Count |
---|---|
93 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.