Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: Error while connect to Access Runtime

$
0
0
Good Morning,

iam developing a windows service with NetOffice.
My Service connects to an Access Applikation and Print the Reports in PDF Format.
This is a example of my connect.
On the developmentsystem is Visual Studio 2013 and MS Office 2013 Professional installed. This includes a full version of Access 2013.
On the Targetsystem is a Runtime of Access 2010 installed.
On Both Systems i can manually open the Access Database, select the Reports and Print them.
But when i use my Service on the Target System i cant connect to Access.

Iam getting the Following error.
"IDispatch wird nicht vom COM-Ziel unterstützt"

Here is my Connectfunction.
   public bool TryConnect(Logger Log)
        {
            try
            {
                if (Access == null)
                    Access = new Application();

                Eventmessages.BeforeOpenAccessDB(Log);
                Access.OpenCurrentDatabase(this.AccessDBFile);  //Line where the Error Occurs.
                Eventmessages.AfterOpenAccessDB(Log);           
                Access.Quit(AcQuitOption.acQuitSaveNone);
                Eventmessages.QuitSuccessfully(Log,true);
               // Access.Dispose();
                Access = null;
                successfully = true;
            }
            catch (Exception ex)
            {
                int i = 1;
                string Error = i + ")" + ex.Message;
                while (ex.InnerException != null)
                {
                    i++;
                    ex = ex.InnerException;
                    Error += Environment.NewLine + i + ")" + ex.Message;
                }

                Access = null;
                Eventmessages.CouldNotConnectToDB(Log, Error,true);
                successfully = false;
            }

            return successfully;
        }
What can i do against that?

Greeting and Merry Christmas

Cazza

Viewing all articles
Browse latest Browse all 1741

Trending Articles