[resolved] Save the file mrt in the database

Stimulsoft Reports.NET discussion
Leandro
Posts: 74
Joined: Tue Aug 08, 2006 9:07 am
Location: Brasil

[resolved] Save the file mrt in the database

Post by Leandro »

Which the best option, to save in disk or in the database?

Did anybody already develop some option to save the file mrt inside of the database sql server?
Is it later as to do for you carry it of the bank for StiWebViewer?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

[resolved] Save the file mrt in the database

Post by Edward »

Hi,

There is two methods for storing of the report template into string and loading report from that string later. Here they are:

string report.SaveToString()

and

report.Load(string reportstring)

Thank you.
Leandro
Posts: 74
Joined: Tue Aug 08, 2006 9:07 am
Location: Brasil

[resolved] Save the file mrt in the database

Post by Leandro »

Thank you.
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

[resolved] Save the file mrt in the database

Post by Ivan »

Hello,

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Leandro
Posts: 74
Joined: Tue Aug 08, 2006 9:07 am
Location: Brasil

[resolved] Save the file mrt in the database

Post by Leandro »

I'm having doubts as to save the file to disk mrt in the database.
Saving to disk is easier to manipulate when you need to make a change in Desginer
Saving the database is easier to back up
What would be more appropriate? What is more used?



Another doubt, I need to buy the license Stimul Report, but the owner of the company would like to know who uses this tool here in Brazil.
Could I pass a list of customers?
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

[resolved] Save the file mrt in the database

Post by Jan »

Hello Leandro,
leandro wrote:I'm having doubts as to save the file to disk mrt in the database.
Saving to disk is easier to manipulate when you need to make a change in Desginer
Saving the database is easier to back up
What would be more appropriate? What is more used?
Your decision depend from your task. If you can't decide what choose create both variants.
Another doubt, I need to buy the license Stimul Report, but the owner of the company would like to know who uses this tool here in Brazil.
Could I pass a list of customers?
Unfortunatelly we can't provide this information. This is private information. Some of our customers give to us testimonials. You can see it at http://stimulsoft.com/Testimonials.aspx

In this list you can find customers from Brazil.

Thank you.
Leandro
Posts: 74
Joined: Tue Aug 08, 2006 9:07 am
Location: Brasil

[resolved] Save the file mrt in the database

Post by Leandro »

Thank you.
Leandro
Posts: 74
Joined: Tue Aug 08, 2006 9:07 am
Location: Brasil

[resolved] Save the file mrt in the database

Post by Leandro »

I made an option to save the mrt in a table in the database.

Code: Select all

// Mrt = Control FileUpload
            if (Mrt.HasFile)
            {
                // Verificar se o arquivo já existe no diretório tmp, Se existir apagar
                String UploadedFile = Mrt.PostedFile.FileName;
                if (File.Exists(Server.MapPath("tmp\\") + UploadedFile))
                {
                    File.Delete(Server.MapPath("tmp\\") + UploadedFile);
                }

                // Salvar o arquivo mrt no diretório tmp do servidor
                int ExtractPos = UploadedFile.LastIndexOf("\\") + 1;
                String UploadedFileName = UploadedFile.Substring(ExtractPos, UploadedFile.Length - ExtractPos);
                Mrt.PostedFile.SaveAs(Server.MapPath("tmp\\") + Path.GetFileName(Mrt.PostedFile.FileName));

                // Cria um report e carrega o arquivo mrt que já esta no diretório do servidor
                StiReport mrt = new StiReport();
                mrt.Load(Server.MapPath("tmp\\") + Path.GetFileName(Mrt.PostedFile.FileName));

                // Passa a string do mrt para o campo do banco de dados
                tb.Mrt = mrt.SaveToString();

                // Apaga o arquivo mrt do diretório temp
                if (File.Exists(Server.MapPath("tmp\\") + UploadedFile))
                {
                    File.Delete(Server.MapPath("tmp\\") + UploadedFile);
                }

            }



This other routine executes to exhibit the mrt in StiWebViewer

Code: Select all

 StiReport mrt = new StiReport();
mrt.LoadFromString(tb.Mrt);
string connString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["Tester"].ConnectionString;
Stimulsoft.Report.Dictionary.StiSqlDatabase sti = new Stimulsoft.Report.Dictionary.StiSqlDatabase("Conexão", "Conexão", connString, false);
mrt.Dictionary.Databases[0] = sti;
StiWebViewer1.Report = mrt;
if somebody has some thing to increase, please sends
arunkrsharmaa
Posts: 4
Joined: Sun Feb 04, 2018 3:45 am

Re: [resolved] Save the file mrt in the database

Post by arunkrsharmaa »

Hi Is this feature available with Stimulsoft.JS also.

We have some existing report saved in xml format and i want to retrieve those mrt files and load in Stimulsoft.js designer\Viewer.

Or there is some other technique for backward compatibility
Thanks
Arun
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: [resolved] Save the file mrt in the database

Post by Lech Kulikowski »

Hello,

You can use save, load events of the designer to work with reports as you need
https://www.stimulsoft.com/en/documenta ... events.htm

Thank you.
Post Reply