Solved

How to access a function

Posted on 2014-01-29
3
182 Views
Last Modified: 2014-01-29
Hi I have this;

        private void bbComDb_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string AccessConnectionString = Properties.Settings.Default.DBRootConnectionString;
            string File_Path = Application.StartupPath + "DBRoot.mdb";
            CompactJetDatabase(AccessConnectionString, File_Path);
            if (CompactJetDatabase) <===================
                XtraMessageBox.Show("Is goed");
            else
                XtraMessageBox.Show("Is niet goed");


        }

        public static bool CompactJetDatabase(string connectionString, string fileName)
        {
            try
            {
                string oldFileName = fileName;
                string newFileName =Path.Combine(Path.GetDirectoryName(oldFileName),
                Guid.NewGuid().ToString("N") + ".mdb");
                JRO.JetEngine objJet = new JRO.JetEngine();
                objJet.CompactDatabase(oldFileName, newFileName);
                objJet.CompactDatabase(String.Format(connectionString, oldFileName),
                 String.Format(connectionString, newFileName));
                File.Delete(oldFileName);
                File.Move(newFileName, oldFileName);
                return true;
            }
            catch
            {
                return false;
            }
        }

Open in new window


How can I access the function?

Greetings, Peter Kiers
0
Comment
Question by:peterkiers
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Philip Pinnell earned 500 total points
ID: 39817345
try this


 private void bbComDb_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            string AccessConnectionString = Properties.Settings.Default.DBRootConnectionString;
            string File_Path = Application.StartupPath + "DBRoot.mdb";
           
            if (CompactJetDatabase(AccessConnectionString, File_Path)) <===================
                XtraMessageBox.Show("Is goed");
            else
                XtraMessageBox.Show("Is niet goed");


        }
0
 
LVL 1

Author Comment

by:peterkiers
ID: 39817356
Thanks. Peter Kiers
0
 
LVL 13

Expert Comment

by:Philip Pinnell
ID: 39817361
Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question