retrieve a name of a PDF file stored in a database field?

bettyboop

Member
Joined
Jan 20, 2022
Messages
6
Programming Experience
Beginner
how do you retrieve a name of a PDF file stored in a database field? If I hard code it works fine
string filename = "name of file here.pdf"
System.Diagnostics.Process.Start(filename);

BUT I would like to retrieve name of pdf file depending on the choice of the user
Example
Craft1 = " craft directions1.pdf"
Craft2 = "craft2 directions.pdf"

When I put :

string filename = patternLinkTextBox.ToString();
System.Diagnostics.Process.Start(filename);

throws exception

The system cannot find the file specified'
 
Solution
Open a new thread when you get to that question about querying the database.

For this thread, this should get you the value stored in the text box:
C#:
string filename = patternLinkTextBox.Text;
The text that a user types into a textbox is in the Text property. You read that property to get the value. You don't use ToString() to get the value.
 
I must be missing something, but how is patternLinkTextBox a database field? Perhaps you meant UI control?
 
the name of the field in database is PatternLink ( I have tried everything I could think of ) Even my teacher could not help! waste of $$ to take 2 classes and what I wanted to do still can not do she said they We know that PDF is not Microsoft technology; it is created by Adobe system and widely used for document exchange, and based on post script. The .Net framework does not provide a library to easily handle PDF files in .Net.

I need to reach into the database retrieve the name of the PDF file and open it I will figure out eventually
 
Open a new thread when you get to that question about querying the database.

For this thread, this should get you the value stored in the text box:
C#:
string filename = patternLinkTextBox.Text;
 
Solution
I may have tried that but GOT it to work as I am an idiot! Make sure the PDF is in the correct place and named EXACTLY same in the database I only have 2 there but it works! YES!! I am so happy Am trying to design a program for my scroll saw patterns ( maybe other crafting programs to TAHNK YOU !
 
Back
Top Bottom