views:

28

answers:

2

Here are my steps:

  1. Created the controls manually by dragging a textbox then a button besides it which i think its not the right way to do it. Example:

alt text

Any idea which control should i use?

2.The column's datatype (in sql-server) is varbinary(MAX) which will hold the document file. Is this the correct datatype for holding documents?

3.In my application, i will have a temporary variable which holds the uploaded/picked document which then i pass the document to the db. What datatype should i use for this temporary variable (which will hold a document file of type .pdf).

I'm using c# Windows Application.

Thanks

A: 
  1. Use the FileUpload control.

  2. yes

  3. byte[] or stream

XIII
A: 

Unless you have a compelling reason for storing documents directly in the database, I would re-think your strategy. Yes it can be done, but it is not always the best way to proceed. In my opinion, it is usually better to store the documents/images in the file system/folders, and then store only the meta-data about the file in the database.

You might have very good reasons why you want to do this, but make sure the reasons are sound. There are some benefits, but a lot of drawbacks as well.

EJB
I see. This is my first time dealing with files. For the time being, i just want the project to be done and later on i will look for better solutions
If that is the case, I would first use the file system approach for storage, and upgrade to storing files directly in the DB at a later date only if you need to.
EJB
What if the windows application is interacting with remote db, how can db locate where the file is in the filesystem? In my case, the filesystem that has document files wouldn't be in db machine that's why i wanted to put the file into db directly. I will be grateful if you could give me good sources that would help achieve what you have said. Thanks
I would have a table that at least contains the path to the file (I also store date of upload, keywords, userid, description etc), so your app would make a call to the db to get the filepath to the file, and then the the application would know where the file is. In my case, for an asp.net app, that would map to a file on the webserver. If this is not a web app, than the file would be stored on a file server mo0st likely. I also create a guid for each file and use that for a guaranteed unique file name before saving to the server. That guid will be your keyfield in the sql table.
EJB