score:2

Accepted answer

Error # 1 - I think you need == instead of just =

string selected = DropDownList1.SelectedValue.ToString();

var query = from meet in db.Meets
            where meet.Summary == selected
            select meet.Doc_Path;

Error #2 - You may need to user Server.MapPath

String FilePath;
FilePath = Server.MapPath(query);

or, to combine them

string selected = DropDownList1.SelectedValue.ToString();

var query = from meet in db.Meets
            where meet.Summary == selected
            select Server.MapPath(meet.Doc_Path);

string[] dirs = Directory.GetDirectories(query);

score:0

Error # 1:

As said before ,you should use == instead of = when making comparison .

Error # 2:

Why you use Directory.GetDirectories(query);

the previous method is used to Get the names of subdirectories (including their paths) in the specified directory.

look here

i think you don't need this method, just use :

string selected = DropDownList1.SelectedValue.ToString();

var query = from meet in db.Meets
            where meet.Summary == selected
            select meet.Doc_Path;

string dirPath = System.Web.HttpContext.Current.Server.MapPath("~") + query.ToString();

Make sure that the meet.Doc_Path value is n't the absolute path, store only the relative path.


Related Articles