Я пытаюсь подключиться 1 C к C#
static void Main()
{
string ConnectString = "Srvr=\"10.1.3.55\";Ref=\"DataBase\";Usr=\"Admin\";Pwd=\"111111\";";
var v83comConnector = Type.GetTypeFromProgID("V83.ComConnector");
var v83 = Activator.CreateInstance(v83comConnector);
Object[] arguments = { ConnectString };
dynamic Connect = v83comConnector.InvokeMember("Connect", BindingFlags.Public |
BindingFlags.InvokeMethod | BindingFlags.Static, null, v83, arguments); // ошибк тут
int count = Connect.Метаданные.Справочники.Количество();
MessageBox.Show(count.ToString());
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Я получаю ошибку
System.Reflection.TargetInvocationException
HResult=0x80131604
Message = the recipient of the call created an exception.
Source = mscorlib
Stack trace:
in System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
in System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
in System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
in MM. Program.Main () in C:\Users\Nikita.Vasilev\Source\Repos\MM\MM\Program.cs:строка 23