Error while retreiving Word Document from database

Posted by Saritha.rajeshkumar under C# on 7/11/2011 | Points: 10 | Views : 1503 | Status : [Member] | Replies : 2
Hi, This is saritha

Iam getting the Error "This file could not be found. ("C:\WINDOWS\system32\...\sample2.docx")" while Retreiving the word document from database

My code is

ApplicationClass wordapp = new ApplicationClass();
jb.jobseekerId = Label4.Text;
jb.showjobseekerresume();
string path = "VasundharaJobs\\Jobseekers\\UPLOAD RESUME\\" + jb.resumepath;
//string path = jb.resumepath;
string filepath = path;
object file = filepath;
object nullobj = System.Reflection.Missing.Value;
Document doc = wordapp.Documents.Open(ref file,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj,
ref nullobj);
Document doc1 = wordapp.ActiveDocument;
string m_Content = doc1.Content.Text;
TxtFile.Text = m_Content;
doc.Close(ref nullobj, ref nullobj, ref nullobj);




Responses

Posted by: T.saravanan on: 7/11/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

I think you were save the file path from one system then access from other system then only its thrown file not found error.
My suggestion is save the file into server system then save that server path into your database.Now you access the file from the server system.Try this....


Thanks,
T.Saravanan

Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 7/12/2011 [Member] Starter | Points: 25

Up
0
Down
Refer this

http://stackoverflow.com/questions/4449544/how-to-save-a-docx-file-in-sql-server-2005-and-display-it-in-aspx-pages-as-docx-d

Thanks&Regards
LakshmiNarayana Nalluri.

Saritha.rajeshkumar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response