declare @test table ( field1 text ); insert into @test values('1234'); select cast(cast(field1 as varchar(max)) as varbinary(max)) from @test;>
>>string query = "SELECT cast(memofieldname as blob)as memofieldname FROM ..."; >>>>
>>>String fileName; >>>fileName = Path.Combine(System.IO.Path.GetTempPath(), >>> "Samplefile.jpg"); >>> >>>if (System.IO.File.Exists(fileName) == true) >>> { >>> System.IO.File.Delete(fileName); >>> } >>> >>>FileStream oFs = new >>> FileStream(fileName, FileMode.CreateNew, FileAccess.ReadWrite); >>> >>>StreamWriter oWriter = new StreamWriter(oFs); >>> >>>ASCIIEncoding asciiEncoding = new ASCIIEncoding(); >>>oWriter.Write(asciiEncoding.GetBytes(reminderMainRow.reFile)); //That is the memo field. >>>oWriter.Flush(); >>>oWriter.Close(); >>>oFs.Close(); >>>