tags:

views:

54

answers:

3

Really hoping someone can provide some code sample or point me in the right direction (with examples C#.net). I did try to check if this question was asked before.. but didn't really find code samples which answered all my questions.

  1. Image folder for saved files -should this be in the solution or somewhere else
  2. What kind of data type - will vchar(150) for example for ok?
  3. What will be the typical/most ideal code to save the image in the folder location and write the image location in the db.
A: 

Not wholly sure what you mean but this could point you in the right direction:

1) Keep it in the solution unless it is to be called by more than application 2) Just use Varchar(Max) or NVarchar(Max) depending on your encoding type 3) You'll need: - In db, a stored procedure to write the image location to a table.In - In the C#, a connection object and a command object to call a stored procedure

Carnotaurus
A: 

If you use SQL Server 2008 I would use the filestream data type. It allows for what you want to do but totally integrated with the DB (you see the column -- image -- as a varbinary(MAX)).

Carles
I do not want to save the images in the DB, only in a folder and reference from DB.
Brandon
With filestream this is exactly what it does (I think)... http://www.mssqltips.com/tip.asp?tip=1489
Carles
A: 

NTFS - Suports multiple Data Streams for each file.

NetFrameWork do´nt include support for those streams.

You can use Interop to gain access to Alternate Data Streams.

Sample Csharp code on CodeProject: http://www.codeproject.com/KB/shell/csadsdetectorarticle.aspx

Note.: When you download a file from internet on Xp, the Dowloaded files has two Streams, MyFile and MyFile:Zone.Identifier

This stream contains some like this: [ZoneTransfer] ZoneId=3

x77
x77