What are the Steps to Upload a Document File from Windows Application to SQL Server DB?
Here are my steps:
- 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:
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 doc开发者_如何学Pythonument 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
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.
Use the FileUpload control.
yes
byte[] or stream
精彩评论