Hi <BR>We are working on ASP.NET back end database SqlServer 2000.<BR><BR>We are encrypting the data in binary format and storing into database without any proble.But while doing the decrypt we need to retrive binary data from database and need to pass our decrypt function.here we are facing proble.when we try to fetch data from databse its always saying nodata error.but when we open table its showing rows.Here actually we need to pass byte datatype to decrypt function. <BR><BR>Basically i want these two steps<BR><BR>1.Retriving binary(encrypted) data from table <BR>2.decryption of retrived data and displaying in datagrid or table.<BR><BR>table name test <BR>columns <BR>fld1 binary 50<BR>fld2 binary 50<BR><BR><BR>for encrypt and decrypt below function are using<BR><BR>private byte[] EncryptText( ICryptoTransform Encryptor, string Data ) <BR> { <BR> using( MemoryStream dataStream = new MemoryStream() ) <BR> { <BR> // encrypt data with received symmetric key <BR> using( CryptoStream streamEncrypt = new CryptoStream( dataStream, Encryptor, CryptoStreamMode.Write ) ) <BR> { <BR> using( StreamWriter encryptStreamWriter = new StreamWriter( streamEncrypt ) ) <BR> { <BR> encryptStreamWriter.Write( Data ); <BR> encryptStreamWriter.Close(); <BR> } <BR> streamEncrypt.Close(); <BR> } <BR> byte[] encryptedData = dataStream.ToArray(); <BR> dataStream.Close(); <BR> return encryptedData; <BR> } <BR> } <BR><BR> private string DecryptText( ICryptoTransform Decryptor, byte[] Data ) <BR> { <BR> using( MemoryStream receivedStream = new MemoryStream( Data ) ) <BR> { <BR> string text; <BR> // decrypt data with symmetric key <BR> using( CryptoStream streamDecrypt = new CryptoStream( receivedStream, Decryptor, CryptoStreamMode.Read ) ) <BR> { <BR> StreamReader decryptStreamReader = new StreamReader( streamDecrypt ); <BR> text = decryptStreamReader.ReadToEnd(); <BR> // do not call close method for StreamReader or CryptoStream if CryptoStream opened in Read mode <BR> // "Stream doesn&#039;t support writing" error will be generated <BR> // decryptStreamReader.Close(); <BR> // streamDecrypt.Close(); <BR> } <BR> receivedStream.Close(); <BR> return text; <BR> } <BR> }<BR><BR><BR><BR>