all groups > dotnet clr > july 2005 >
You're in the

dotnet clr

group:

Accessing data of Microsoft Project?


Accessing data of Microsoft Project? mehrnoosh
7/30/2005 3:56:23 AM
dotnet clr:
Hi
i want to access and edit Microsoft Project datas via .net programming.
can you help me,please?
It''s very important for me.

regards

-----------------------------
This message is posted by http://asp.forumszone.com
Re: Accessing data of Microsoft Project? Mitch Denny
8/6/2005 12:00:00 AM
Here you go (uses the OLEDB provider for MS Project). It may help to add =
the mpp file as a data connection in server explorer so you can figure =
out what the schema is (I just took a guess).

1 using System;
2 using System.Data.OleDb;
3=20
4 namespace MppDump
5 {
6 public class Class1
7 {
8 public static void Main(string[] args)
9 {
10 OleDbConnection connection =3D new OleDbConnection(
11 @"Provider=3DMicrosoft.Project.OLEDB.11.0;Initial =
Catalog=3DC:\Demo.mpp;"
12 );
13 connection.Open();
14 OleDbCommand command =3D new OleDbCommand("select * from =
Tasks", connection);
15 OleDbDataReader reader =3D command.ExecuteReader();
16=20
17 while (reader.Read())
18 {
19 Console.WriteLine(reader["TaskName"]);
20 }
21 }
22 }
23 }



--=20



Mitch Denny
email: mitch.denny@notgartner.com
mobile: +61 (414) 610-141
blog: http://notgartner.com
skype: callto://mitchdenny
=20

[quoted text, click to view]
Re: Accessing data of Microsoft Project? mehrnoosh
8/10/2005 4:29:25 PM
Hi
and thanks for your reply.
I tested it but I recieved an error message:
"Invalid token 'namespace' in class, struct, or interface member
declaration."
and
"A namespace does not directly contain members such as fields or
methods"
what should I do?
thanks so much.

mehrnoosh



--
Sent via .NET Newsgroups
AddThis Social Bookmark Button