Save data in the Database
Save data in the Database
Hi Stimulsoft,
in my report i must to add a new task as i exaplin you know,
in the Database (SqlServer) that i use to retrieve data to compile the report i create a Table (ReportCompiled) to save each time the data of report created, with these field :
- ReportId (int)
- ReportName (string)
- Country (string)
- Language (string)
- Operator (string)
- Recharge (decimal)
- DateCreated (datetime)
- DateModified(datetime)
- UserModified (string)
- Report (byte) -----> to save the report in .MDC and reuse when need to change some feature.
My purpose of this Table is to save the data for each report created (i wish perform it just clicking a Button to save data in database) and so i ask you if it is possible perform this task (i did not see examples about that) and if there are some example where i can take some idea.
Thanks for your attention.
Have a good day.
Cheers
in my report i must to add a new task as i exaplin you know,
in the Database (SqlServer) that i use to retrieve data to compile the report i create a Table (ReportCompiled) to save each time the data of report created, with these field :
- ReportId (int)
- ReportName (string)
- Country (string)
- Language (string)
- Operator (string)
- Recharge (decimal)
- DateCreated (datetime)
- DateModified(datetime)
- UserModified (string)
- Report (byte) -----> to save the report in .MDC and reuse when need to change some feature.
My purpose of this Table is to save the data for each report created (i wish perform it just clicking a Button to save data in database) and so i ask you if it is possible perform this task (i did not see examples about that) and if there are some example where i can take some idea.
Thanks for your attention.
Have a good day.
Cheers
Save data in the Database
Hello,
You can create the procedure that will add a record to the table in your base
In your report in dictionary add Stored Procedure with parameters @ReportID,@ReportName,@Country.
Then, when pressing the button, pass parameters to this procedure in the report and run for execution.
Thank you.
You can create the procedure that will add a record to the table in your base
Code: Select all
CREATE PROCEDURE [dbo].[InsertIntoTableValueFromReport]
(@ReportID int, @ReportName varchar(50), @Country varchar(50))
AS
BEGIN
INSERT INTO TableReport(ReportID, ReportName,Country) VALUES(@ReportID,@ReportName,@Country)
END
Code: Select all
exec InsertIntoTableValueFromReport @ReportID,@ReportName,@Country
Thank you.
Save data in the Database
Hi Aleksey ,
your snippet work good
, i can save the data in my Table but just one step i get stuck ;
in my table i create a field : Report (Varbinary) -----> to save the report in .MDC and reuse when need to change some feature, and i am trying the way hot to save the Report in the database .
Should i use a snippet like this one:
and after pass this value to the parameter and save in the Database?
Thanks for you attention.
Have a good day.
Cheers
your snippet work good
in my table i create a field : Report (Varbinary) -----> to save the report in .MDC and reuse when need to change some feature, and i am trying the way hot to save the Report in the database .
Should i use a snippet like this one:
Code: Select all
using (Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport())
{
byte[] reportByte = report.SaveToByteArray();
reportByte = report.SaveToByteArray();
Thanks for you attention.
Have a good day.
Cheers
Save data in the Database
Hello,
In this case, you can save the report in the EndRender event: SaveDocumentToByteArray()
create a new SQLConnection, create a new SQLCommand, send the saved report to the parameter and execute.
Thank you.
In this case, you can save the report in the EndRender event: SaveDocumentToByteArray()
create a new SQLConnection, create a new SQLCommand, send the saved report to the parameter and execute.
Thank you.
Save data in the Database
Hi Aleksey,
i tried to follow your way but not luck ,so i ask you if there is a document about this task so i can underdtand better how to work out it.
Thanks for your attention.
Have a good day.
Cheers
i tried to follow your way but not luck ,so i ask you if there is a document about this task so i can underdtand better how to work out it.
Thanks for your attention.
Have a good day.
Cheers
Save data in the Database
Hello,
Thank you.
Unfortunately, there is such a documentation on this issue because we think that this action is a bit not correct. The report designer must only show data without making any changes in the database, any changes in the database should be made in your application, but not in the report.jjc wrote:i tried to follow your way but not luck ,so i ask you if there is a document about this task so i can underdtand better how to work out it.
Thank you.