I need to save a report into a string or for binary, but I have had problems. Where save the report unless it is empty. All changes are lost. When it except for torque can not load.
You have a solution to save and read reports in database? I bought the product to do this and I can not.
Then my code:
Dim str As String = Report.SaveDocumentToString ()
OR
Dim strReport The String = Report.SaveToString ()
Call SaveDllString (str, 100)
Public Sub SaveDllString (ByVal nameReportDll The String, ByVal chid The Integer)
The String Dim connectionString = GetConnectionString ()
Dim connection As New SqlConnection (connectionString)
Dim CMD The SqlCommand
connection.Open ()
cmd = New SqlCommand ( "INSERT INTO CfgReport (chid, reportDllName) VALUES (@ CHID, @ DLL)," connection)
cmd.Parameters.Add (New SqlParameter ( "CHID @", SqlDbType.Int, 4)). chid Value =
cmd.Parameters.Add ( "@ DLL", SqlDbType.NVarChar). nameReportDll Value =
cmd.ExecuteNonQuery ()
connection.Close ()
End Sub
To read:
Dim i As Integer = ds.Tables ( "CfgReport"). Rows.Count
If i> 0 Then
Report.LoadDocumentFromString (ds.Tables ( "CfgReport"). Rows (i - 1) ( "reportDllName"))
End If
============
Public Function ReadDllString () The DataSet
Dim cn As New SqlConnection (GetConnectionString)
Dim of The New SqlDataAdapter _
( "SELECT * FROM CfgReport WHERE chid = 100", cn)
The SqlCommandBuilder Dim cb = New SqlCommandBuilder (of)
Dim DS As New DataSet
Try
cn.Open ()
da.Fill (ds, "CfgReport")
Dim RW The DataRow
rw = ds.Tables ( "CfgReport"). Rows (0)
Dim i As Integer = ds.Tables ( "CfgReport"). Rows.Count
If i> 0 Then
Dim bdll The String = _
ds.Tables ( "CfgReport"). Rows (i - 1) ( "reportDllName")
End If
Return DS
Catch ex As Exception
Throw ex
Finally
cn.Close ()
cn = Nothing
End Try
End Function:brick:
Save and Read reports in Database
-
- Posts: 2
- Joined: Wed May 14, 2008 7:43 pm
- Location: Brazil
Save and Read reports in Database
Hello Marcelo,
This line of code is not correct:
Please use following:
Methods LoadDocumentFromString and SaveDocumentToString saves rendered report.
Thank you.
This line of code is not correct:
Code: Select all
Report.LoadDocumentFromString (ds.Tables ( "CfgReport"). Rows (i - 1) ( "reportDllName"))
Code: Select all
Report.LoadFromString (ds.Tables ( "CfgReport"). Rows (i - 1) ( "reportDllName"))
Thank you.