Click here to Skip to main content
15,882,750 members
Home / Discussions / C#
   

C#

 
GeneralRe: Constructing a class from a static function Pin
PIEBALDconsult17-Feb-11 4:27
mvePIEBALDconsult17-Feb-11 4:27 
AnswerRe: Constructing a class from a static function Pin
Not Active17-Feb-11 2:25
mentorNot Active17-Feb-11 2:25 
GeneralRe: Constructing a class from a static function Pin
musefan17-Feb-11 2:43
musefan17-Feb-11 2:43 
Questiontext file > Binary and Binary > Text file Pin
grmihel217-Feb-11 0:39
grmihel217-Feb-11 0:39 
AnswerRe: text file > Binary and Binary > Text file Pin
Ravi Sant17-Feb-11 1:15
Ravi Sant17-Feb-11 1:15 
GeneralRe: text file > Binary and Binary > Text file Pin
grmihel217-Feb-11 1:26
grmihel217-Feb-11 1:26 
AnswerRe: text file > Binary and Binary > Text file Pin
Richard MacCutchan17-Feb-11 1:15
mveRichard MacCutchan17-Feb-11 1:15 
GeneralRe: text file > Binary and Binary > Text file Pin
grmihel217-Feb-11 1:22
grmihel217-Feb-11 1:22 
I used FileStream like this:
public byte[] ReadFile(string filePath)
        {
            byte[] buffer;
            FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
            try
            {
                int length = (int)fileStream.Length;  // get file length
                buffer = new byte[length];            // create buffer
                int count;                            // actual number of bytes read
                int sum = 0;                          // total number of bytes read

                // read until Read method returns 0 (end of the stream has been reached)
                while ((count = fileStream.Read(buffer, sum, length - sum)) > 0)
                    sum += count;  // sum is a buffer offset for next reading
            }
            finally
            {
                fileStream.Close();
            }
            return buffer;
        }

and stored the returned value byte[] as the varbinary into the Database... Try'd to figure the reverse way back, but didn't worked that well tbh, maybe because I didn't do it the write way, but when I stored it as .docx the file was 'damage' and when I store it as .txt there is just binary numbers.
GeneralRe: text file > Binary and Binary > Text file Pin
Richard MacCutchan17-Feb-11 1:46
mveRichard MacCutchan17-Feb-11 1:46 
GeneralRe: text file > Binary and Binary > Text file Pin
grmihel217-Feb-11 4:07
grmihel217-Feb-11 4:07 
GeneralRe: text file > Binary and Binary > Text file Pin
Richard MacCutchan17-Feb-11 4:24
mveRichard MacCutchan17-Feb-11 4:24 
GeneralRe: text file > Binary and Binary > Text file Pin
grmihel217-Feb-11 4:28
grmihel217-Feb-11 4:28 
GeneralRe: text file > Binary and Binary > Text file Pin
Richard MacCutchan17-Feb-11 4:33
mveRichard MacCutchan17-Feb-11 4:33 
GeneralRe: text file > Binary and Binary > Text file Pin
grmihel218-Feb-11 0:14
grmihel218-Feb-11 0:14 
GeneralRe: text file > Binary and Binary > Text file Pin
Richard MacCutchan18-Feb-11 1:36
mveRichard MacCutchan18-Feb-11 1:36 
GeneralRe: text file > Binary and Binary > Text file Pin
grmihel218-Feb-11 2:12
grmihel218-Feb-11 2:12 
GeneralRe: text file > Binary and Binary > Text file Pin
Richard MacCutchan18-Feb-11 2:45
mveRichard MacCutchan18-Feb-11 2:45 
QuestionDo I need to store my database in Application Data folder instead of Application.StartUp folder Pin
Nadia Monalisa16-Feb-11 22:35
Nadia Monalisa16-Feb-11 22:35 
AnswerRe: Do I need to store my database in Application Data folder instead of Application.StartUp folder Pin
Bernhard Hiller16-Feb-11 22:51
Bernhard Hiller16-Feb-11 22:51 
AnswerRe: Do I need to store my database in Application Data folder instead of Application.StartUp folder Pin
PIEBALDconsult17-Feb-11 1:47
mvePIEBALDconsult17-Feb-11 1:47 
QuestionEncryption and descryption using 3DES [modified] Pin
sarang_k16-Feb-11 21:58
sarang_k16-Feb-11 21:58 
AnswerRe: Encryption and descryption using 3DES Pin
OriginalGriff16-Feb-11 22:48
mveOriginalGriff16-Feb-11 22:48 
AnswerRe: Encryption and descryption using 3DES Pin
Bernhard Hiller16-Feb-11 22:56
Bernhard Hiller16-Feb-11 22:56 
AnswerRe: Encryption and descryption using 3DES Pin
RaviRanjanKr21-Feb-11 18:05
professionalRaviRanjanKr21-Feb-11 18:05 
QuestionHow to prevent usage of class libraries shipped with application? Pin
Chesnokov Yuriy16-Feb-11 21:37
professionalChesnokov Yuriy16-Feb-11 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.