Microsoft.Project.OLEDB.11.0 Exception

A

ansu

Hi All,

Iam getting the following error while reading MSProject file,

"Provider cannot be found,It may not be properly installed." when i try
to do

private bool IsProjcectOledDBSupported(string filename) {
ADODB.ConnectionClass conn = new ADODB.ConnectionClass();

try
{

conn.Disconnect += new
ADODB.ConnectionEvents_DisconnectEventHandler(conn_Disconnect);
conn.CommandTimeout = 30;
conn.Open("Provider=Microsoft.Project.OLEDB.11.0;PROJECT
NAME=" + filename, null, null, 0); ---Getting Error at this line
conn.Close();
conn.Cancel();
conn = null;

}
catch (Exception ex)
{
conn = null;
return false;
}
return true;

}

Note : I have MSProject 2003 Installed on my system.

Need Help,
Regards.
 
R

Rod Gill

Hi,

This is why VB is so much quicker to debug! In VB I would get this code
working in Excel VBA then copy to VB and it would pretty much work.

Have you fully defined the file path (as in "C:|Projects\MyProject.mpp")?

Note the 2003 oledb driver can't read Project 2007 format files and 2007
does not support oledb.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
A

ansu

Hi Rod
Thank you very much for quick response,yes i know that oledb drive
can't read Project 2007 format files ,iam trying to read 2003 MS Projec
File only and file name is also proper. :

Rod,I have a Question away from current topic,i hope you don't mind an
guide me in a right way

Some days back i Automated Import/Export of Ms Project in m
application,evrything is working fine,but only concern is time.It i
taking a lot of time to import/Export

this is what iam doing for Import

/
Sample Cod
foreach (MSProject.Task task in this.msProj.Tasks

if (task.Notes == string.Empty
rowArray.Add("No Notes")
els
rowArray.Add(task.Notes)

rowArray.Add(Convert.ToInt32(task.GetField(MSProject.PjField.pjTaskOutlineLevel)));//levelI
rowArray.Add(Convert.ToDouble(task.Duration)
480)
rowArray.Add(Convert.ToDateTime(task.Start))
rowArray.Add(Convert.ToDateTime(task.Finish))
// Add rowArray to my DataTable and then saving it to backend,thi
whole process is taking a lot of time


*

For Expor
/
// Reading each row from datatable and adding it to tas
//msProj is MSProject.Project objec

this.msProj.Tasks.Add(dRow["TaskName"].ToString()
System.Reflection.Missing.Value)

this.msProj.Tasks[this.msProj.Tasks.Count].SetField(MSProject.PjField.pjTaskOutlineLevel
outLineLevel.ToString())
task.Duration = dRow["Duration"]
if (dRow["Duration"].ToString() == "0"

task.Start = plndStart
task.Finish = plndEnd


// This export is taking too much of tim

*

can u please tell me how can i improve the performance whil
import/expor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top