Glossary Item Box
Use the AddCode method to inject code into the script.
The AddCode method allows actual code segments to be added to the script at run time. This is useful for allowing secure information, such as a database connection string or SQL query string, to be used inside the script without having to save it into the RPX file.
[C#] public string addThisCode() { string sCode = "public string ShowACMessage()"; sCode += "{"; sCode += "return \"my Added Code\";"; sCode +="}"; return sCode; } private void rptAddCode_ReportStart(object sender, System.EventArgs eArgs) { this.AddCode(addThisCode()); }
[Visual Basic] Public Function addThisCode() As String Dim sCode as String sCode = "public string ShowACMessage(){return ""my Added Code"";}" addThisCode = sCode End Function Private Sub rptAddCode_ReportStart(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ReportStart this.AddCode(addThisCode()) End Sub
[Script] public void Detail_Format() { rpt.TextBox1.Text = ShowACMessage(); }
See Also |
Concepts: Scripting
Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.