Hi all, A noob question, I have trouble trying to port an existing vb.net snippet to pascal. Can anyone provide a code snippet where we can download and view a file from a Database? A binary(jpeg/pdf file) was uploaded to a database table. The code will just download the file uploaded and view it.
In vb.net this can be done: / if conn.State = ConnectionState.Closed Then conn.Open()// // sql = "Select binfile from graphicfiles WHERE id=" & id// // // cmd = New NpgsqlCommand(sql, conn)// // // Dim fileData As Byte() = DirectCast(cmd.ExecuteScalar(), Byte())// // // Dim sTempFileName As String = Path.GetTempPath & "\" & sFileName// // // If Not fileData Is Nothing Then// // // 'Read image data into a file stream // // Using fs As New FileStream(sTempFileName, FileMode.OpenOrCreate, FileAccess.Write)// // fs.Write(fileData, 0, fileData.Length)// // 'Set image variable value using memory stream. // // fs.Flush()// // fs.Close()// // End Using// // // Process.Start(sTempFileName) 'Open file// // // End If// / Thanks,, Allan
smime.p7s
Description: S/MIME Cryptographic Signature
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus