Du wiederholst dich. Gru�, Thomas _____________________________________ http://blogs.dotnetgerman.com/thomas/
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Basri Shabani > Sent: Friday, February 04, 2005 9:53 PM > To: [email protected] > Subject: [Asp.net] externe DLL einbeziehen > > Hallo Leute, > > ich muss f�r ein intranet programm (asp.net mit c#) auf eine > dll zugreifen mit deren hilfe man auf eine fremde datenbank > user anlegen kann usw. ich habe auch eine beispiel daf�r > gefunden wie man das machen kann, jedoch ist diese beispiel > (siehe unten) in c++ geschrieben. kann jemand mir helfen und > erkl�ren, wie man das in c# macht? Danke im Voraus > > > > mfg bas > > > > Example 1: Creating a new user account > > As an example, we will try to insert a new user �mary� into > OmniTracker�s database. > > * Create a new dialog-based project using the �MFC > AppWizard (exe)�. > > * Add a button called �Add User� to the dialog. > > * Assign a handler OnAddUser() to the button, and fill it > with the following code: > > IOtApplicationPtr pApp; > > HRESULT hr = pApp.CreateInstance(__uuidof(OtApplication), NULL, > > CLSCTX_INPROC_SERVER); > > if (FAILED(hr)) > > { > > CString str; > > str.Format ("CreateInstance() failed: 0x%08lx", > > (ULONG) hr); > > AfxMessageBox (str); > > } > > try { > > IOtSessionPtr pSession; > > pSession = pApp->MakeSession("hostname", 4567, > > "superuser", "password"); > > > > IOtUsersPtr pUsers; > > pUsers = pSession->Users; > > > > IOtUserPtr pUser; > > pUser = pUsers->Add(); > > > > pUser->LoginName = "mary"; > > pUser->EmailAddress = "[EMAIL PROTECTED]"; > > pUser->Password = "65gh45"; > > pUser->DisplayName = "Mary"; > > pUser->Save(); > > > > } catch(_com_error& e) { > > _bstr_t bstrDescription(e.Description()); > > AfxMessageBox((LPCTSTR) bstrDescription); > > } > > > > > * At the top of the file containing OnAddUser(), add the > following line: > > #import "otaut.tlb" no_namespace > > This imports the definitions from the OmniTracker Automation > interface. > > * Make sure, that the OmniTracker installation directory > is part of the list of the C++ preprocessor �s include directories. > > * In the InitInstance() routine of your application, > initialize COM by including the following lines: > > HRESULT hr = CoInitialize(NULL); > > if (FAILED(hr)) > > { > > AfxMessageBox ("Cannot initialize COM!"); > > return FALSE; > > } > > > > * Compile and link the source files, and execute the program. > > _______________________________________________ Asp.net Mailingliste, Postings senden an: [email protected] An-/Abmeldung und Suchfunktion unter: http://www.glengamoi.com/mailman/listinfo/asp.net
