Beispiel #1
0
    public byte[] ShowEmpImage(int imgID)
    {
        dbClass    db  = new dbClass();
        string     sql = "SELECT LOGpdf FROM tableName WHERE LOGuid = @ID";
        SqlCommand cmd = new SqlCommand(sql, db.con);

        cmd.CommandType = CommandType.Text;
        cmd.Parameters.AddWithValue("@ID", imgID);
        object img = null;

        try
        {
            db.Connect();
            img = cmd.ExecuteScalar();
        }
        catch
        {
            return(null);
        }
        finally
        {
            db.Disconnect();
        }
        return((byte[])img);
    }